我对使用Django框架的Reddit OAuth感到困惑。我是否需要使用定义为in the docs的“REDDIT_APP_KEY”和“REDDIT_API_SECRET”,或者此代码是否使用“SOCIAL_AUTH_REDDIT_KEY”和“SOCIAL_AUTH_REDDIT_SECRET”?
我收到了401 unauthorized error trying to authenticate
,即使通过卷曲确保我的钥匙没问题。
enter codeif 'SSL_ONLY' in os.environ and os.environ['SSL_ONLY'] == "1":
SECURE_SSL_REDIRECT = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# ticketer specific configs
if 'REDDIT_APP_ID' not in os.environ or 'REDDIT_APP_ID' not in os.environ:
raise Exception("You need to set social keys in your env. Either do it on the command line\
\nor set it in .env and use `heroku local:run !!` to run this")
REDDIT_USERAGENT = ""
REDDIT_OAUTH_SCOPES = {"identity", "privatemessages"}
SOCIAL_AUTH_REDDIT_KEY = os.environ['SOCIAL_AUTH_REDDIT_KEY']
SOCIAL_AUTH_REDDIT_SECRET = os.environ['SOCIAL_AUTH_REDDIT_SECRET']
SOCIAL_AUTH_REDDIT_AUTH_EXTRA_ARGUMENTS = {"duration": "permanent", "scope": ",".join(REDDIT_OAUTH_SCOPES)}
SOCIAL_AUTH_REDDIT_REDIRECT = "https://reddit-modmail-ticketer.herokuapp.com/complete/reddit/"
here