授权错误烧瓶SSO重定向网址

时间:2020-09-18 14:51:40

标签: python google-oauth flask-login

我创建了烧瓶应用程序,在其中使用google oauth登录

from authlib.integrations.flask_client import OAuth
oauth = OAuth(app)
oauth.register(
    name='google',
    client_id='clientid',
    client_secret='client secret',
    access_token_url='https://accounts.google.com/o/oauth2/token',
    access_token_params=None,
    authorize_url='https://accounts.google.com/o/oauth2/auth',
    authorize_params=None,
    api_base_url='https://www.googleapis.com/oauth2/v1/',
    client_kwargs={'scope':'openid profile email'}

)

当我在本地系统上运行此应用程序时,它运行得很好 我将这个应用程序托管在somexyz.com上,并将此URL添加到凭据上的授权JavaScript起源和授权重定向URI

但是问题是当我单击登录按钮时,它将使用127.0.0.1:5000/authorise URL转到google授权页面,并显示授权错误

Error 400: redirect_uri_mismatch
The redirect URI in the request, http://127.0.0.1:5000/authorize, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/

提前谢谢!

0 个答案:

没有答案