我正在尝试使用Rauth建立一个Flask登录系统,但是我收到了一个错误:
{
"error": {
"message": "Invalid redirect_uri: Given URL is not permitted by the Application configuration",
"type": "OAuthException",
"code": 191
}
}
虽然我不确定这是代码问题还是我的Facebook应用程序设置问题,但这里是我的代码:
^{pr2}$以下是我的观点:
@account.route('/authorize/<provider>')
def oauth_authorize(provider):
if checkLoggedIn():
return redirect(url_for('main.index'))
oauth = OAuthSignIn.get_provider(provider)
return oauth.authorize()
@account.route('/callback/<provider>')
def oauth_callback(provider):
if checkLoggedIn():
return redirect(url_for('index'))
oauth = OAuthSignIn.get_provider(provider)
socialID, name, email = oauth.callback()
print socialID, name, email
if socialID is None:
flash('Authentication failed.')
return redirect(url_for('index'))
user = User.query.filter_by(social_id=social_id).first()
if not user:
user = User(social_id=social_id, nickname=username, email=email)
db.session.add(user)
db.session.commit()
login_user(user, True)
return redirect(url_for('index'))
我读到一些other answers我应该将Facebook应用程序设置中的站点URL设置为我的URL,即http://localhost:5000/,但仍然会收到错误。我从Flask Mega Tutorial得到了代码,所以我不认为这有任何错误。在
是什么导致了这个问题,如何解决?谢谢。在
如果你在Facebook中的网址是http://localhost:5000,你需要通过浏览器中的http://localhost:5000来访问这个应用程序——在这种情况下,Facebook不会识别出{a3}与{a1}相同,这就是为什么会得到无效的URL消息。在
相关问题 更多 >
编程相关推荐