Reddit OAuth2 用户认证

Reddit OAuth2 User Authentication

我正在开发一个网络应用程序,它要求用户登录到他们的 reddit 帐户,并根据 https://github.com/reddit/reddit/wiki/OAuth2#retrieving-the-access-token I need to send a POST request to https://www.reddit.com/api/v1/access_token 使用一些参数。我目前是 运行 来自 localhost 的服务器,但我不断收到错误消息:

XMLHttpRequest cannot load https://www.reddit.com/api/v1/access_token. Request header field Access-Control-Allow-Origin is not allowed by Access-Control-Allow-Headers.

我一直在努力解决同样的问题,并发现我需要将我的应用程序注册为 "Installed" 而不是 "Web"。这将使授权重定向使用不记名令牌而不是代码。

http://wattydev.com/authenticating_a_js-based_reddit_application_with_user_login_%28implicit_grant_flow%29