Google OAuth 2.0 redirect_uri_mismatch 错误 [英] Google OAuth 2.0 redirect_uri_mismatch error

查看:22
本文介绍了Google OAuth 2.0 redirect_uri_mismatch 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 我在 Google Developer Console 中创建了 Google OAuth 2.0 ClientIDsecret

  2. 之后,我在 Google OAuth 游乐场 (

    <块引用>

    1. 点击菜单图标

    <块引用>

    1. 点击API Manager菜单

    <块引用>

    1. 点击Credentials 菜单.在 OAuth 2.0 Client IDs 下,您将找到您的客户端名称.就我而言,它是 Web Client 1.单击它,将出现一个弹出窗口,您可以在其中编辑 Authorized Javascript OriginAuthorized redirect URIs.

    这是一篇关于创建项目和客户端 ID.

    1. I created a Google OAuth 2.0 ClientID and secret in Google Developer console

    2. After that I tested in Google OAuth playground (https://developers.google.com/oauthplayground). and registered ClientID and secret already created above and applied to Google OAuth 2.0 playground setting menu.

    3. 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 same redirect_uri_mismatch.

    How can I solve this?

    解决方案

    Your site URL and the Authorized 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 is non-www (http://example.com).

    Other common URI mismatch are:

    • Using http:// in Authorized Redirect URIs and https:// 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).

    1. Go to https://console.developers.google.com

    2. Select your Project

    1. Click on the menu icon

    1. Click on API Manager menu

    1. Click on Credentials menu. And under OAuth 2.0 Client IDs, you will find your client name. In my case, it is Web 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆