Google OAuth 2 authorization - Error: redirect_uri_mismatch

前端 未结 30 1937
遥遥无期
遥遥无期 2020-11-22 02:58

On the website https://code.google.com/apis/console I have registered my application, set up generated Client ID: and Client Secret to my a

30条回答
  •  礼貌的吻别
    2020-11-22 03:20

    In my case it was www and non-www URL. Actual site had www URL and the Authorized Redirect URIs in Google Developer Console had non-www URL. Hence, there was mismatch in redirect URI. I solved it by updating Authorized Redirect URIs in Google Developer Console to www URL.

    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 are the step-by-step screenshots of Google Developer Console so that it would be helpful for those who are getting it difficult to locate the developer console page to update redirect URIs.

    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.

提交回复
热议问题