Google oauth 授权错误。 'Error 400: redirect_uri_mismatch'
Google oauth authorization error. 'Error 400: redirect_uri_mismatch'
为什么我在尝试授权我的 Oauth 应用程序时收到此错误。
Authorization Error
Error 400: redirect_uri_mismatch
You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy. \n\nIf you're the app developer, register the redirect URI in the Google Cloud Console.
Learn more
Request Details
redirect_uri=http://localhost:8080/
重定向 URL https://localhost:8080
已在 google 云控制台中注册,但我仍然收到此错误。
Python 文件
from google_auth_oauthlib.flow import InstalledAppFlow
flow = InstalledAppFlow.from_client_secrets_file('client_secrets.json',
scopes = ['https://www.googleapis.com/auth/youtube.readonly'])
flow.run_local_server(port=8080)
client_secrets.json
{
"web": {
"client_id": "$id",
"project_id": "youtube-constant-update",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "$secret",
"redirect_uris": ["https://localhost:8080"]
}
}
欢迎任何类型的 support/help
谢谢
http 和 https 是不同的 URI。您注册了 https,但错误消息是针对 http 的。 URI 包括方案。
注册重定向 URI http://localhost:8080/
为什么我在尝试授权我的 Oauth 应用程序时收到此错误。
Authorization Error
Error 400: redirect_uri_mismatch
You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy. \n\nIf you're the app developer, register the redirect URI in the Google Cloud Console.
Learn more
Request Details
redirect_uri=http://localhost:8080/
重定向 URL https://localhost:8080
已在 google 云控制台中注册,但我仍然收到此错误。
Python 文件
from google_auth_oauthlib.flow import InstalledAppFlow
flow = InstalledAppFlow.from_client_secrets_file('client_secrets.json',
scopes = ['https://www.googleapis.com/auth/youtube.readonly'])
flow.run_local_server(port=8080)
client_secrets.json
{
"web": {
"client_id": "$id",
"project_id": "youtube-constant-update",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "$secret",
"redirect_uris": ["https://localhost:8080"]
}
}
欢迎任何类型的 support/help
谢谢
http 和 https 是不同的 URI。您注册了 https,但错误消息是针对 http 的。 URI 包括方案。
注册重定向 URI http://localhost:8080/