Google OAuth 2.0 redirect_uri_mismatch 错误 [英] Google OAuth 2.0 redirect_uri_mismatch error
问题描述
我在 Google Developer Console 中创建了 Google OAuth 2.0
ClientID
和secret
之后,我在 Google OAuth 游乐场 (
<块引用>- 点击菜单图标
- 点击
API Manager
菜单
- 点击
Credentials
菜单.在OAuth 2.0 Client IDs
下,您将找到您的客户端名称.就我而言,它是Web Client 1
.单击它,将出现一个弹出窗口,您可以在其中编辑 Authorized Javascript Origin 和 Authorized redirect URIs.
这是一篇关于创建项目和客户端 ID.
I created a Google OAuth 2.0
ClientID
andsecret
in Google Developer consoleAfter that I tested in Google OAuth playground (https://developers.google.com/oauthplayground). and registered
ClientID
andsecret
already created above and applied to Google OAuth 2.0 playground setting menu.Some people say that after creating
ClientID
/secret
they need some time for testing. So after two days I tried to test in the same conditions but the error is sameredirect_uri_mismatch
.
How can I solve this?
解决方案Your
site URL
and theAuthorized redirect URIs
in developer console should be the exact match.This kind of error occurs if one URL has
www
(http://www.example.com
) and the other URL isnon-www
(http://example.com
).Other common URI mismatch are:
- Using
http://
in Authorized Redirect URIs andhttps://
as actual URL, or vice-versa - Using trailing slash (
http://example.com/
) in Authorized Redirect URIs and not using trailing slash (http://example.com
) as actual URL, or vice-versa
Here is the step-by-step procedure (with screenshots) to update the Authorized redirect URIs in Google Developer Console (For those like me who found it difficult to get to that page).
Select your Project
- Click on the menu icon
- Click on
API Manager
menu
- Click on
Credentials
menu. And underOAuth 2.0 Client IDs
, you will find your client name. In my case, it isWeb Client 1
. Click on it and a popup will appear where you can edit Authorized Javascript Origin and Authorized redirect URIs.
Here is a Google article on creating project and client ID.
这篇关于Google OAuth 2.0 redirect_uri_mismatch 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!