Warm tip: This article is reproduced from serverfault.com, please click

javascript-Reddit OAuth2 用户身份验证

(javascript - Reddit OAuth2 User Authentication)

发布于 2015-09-01 01:39:14

我正在开发一个需要用户登录他们的 reddit 帐户的网络应用程序,根据https://github.com/reddit/reddit/wiki/OAuth2#retrieving-the-access-token我需要发送一个 POST 请求到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.

Questioner
Ol' Reliable
Viewed
0
Watty 2016-05-29 09:32:21

我正在为同样的问题苦苦挣扎,并发现我需要将我的应用程序注册为“已安装”而不是“Web”。这将使授权重定向使用不记名令牌而不是代码。

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