Got origin_mismatch error in Google+ share api

后端 未结 16 820
醉梦人生
醉梦人生 2020-12-03 07:04

I want to share some dynamic content on google+. For this I checked it https://developers.google.com/+/web/share/interactive#rendering_the_button_with_javascript

<         


        
相关标签:
16条回答
  • 2020-12-03 07:27

    1: Open the Credentials page for your project.

    2:Double-click on your OAuth 2.0 Web client in the client ID list.

    3: Make sure that in the web client ID form, change the Authorized JavaScript origins field to http://localhost:8080 when you are running the server locally. When running remotely add the corresponding appspot server url.

    0 讨论(0)
  • 2020-12-03 07:28

    I had this error trying to use the "Google Play Games Services Management Demo" and it was because of missing "www" in the URL

    0 讨论(0)
  • 2020-12-03 07:30

    Origin mismatch is normally caused by the Javascript origins not being set correctly in the API project console. You need to make sure that the Javascript origins match the domain from which your requests are coming and to which you are returning the user after sign in.

    More details can be found in the developer documentation in the "Create a client ID and client secret" section.

    Note: A common mistake here is to add javascript origins for http:// but not https:// (or vice versa). If you want to allow users to access your site from both then you need to list both in the javascript console.

    Note (Thanks Bethel Goka): You must include the port number of your server in the javascript origins if a port number appears in the url when users access your site.

    0 讨论(0)
  • 2020-12-03 07:33

    I same had the problem for google + api sign in.I was getting Error:origin_mismatch and same details were there as they are in the question .. my javascript credentials had http://localhost:4567 but when I run the python file it opened the link as 0.0.0.0:4567 thats basically a localhost but when i changed the url in browser to http://localhost:4567 now the error was removed .. and my application was able to get the OAuth box .. and all went fine!!! this thing removed my error... Please let me know whether I was correct because I just started learning how to use apis

    0 讨论(0)
  • 2020-12-03 07:38

    (The error has the answer for you)

    need to set javascript origin in google console api As

    origin=**http://www.pubandbar-network.co.uk**
    
    scope=https://www.googleapis.com/auth/plus.login
    response_type=code token id_token gsession
    access_type=online
    redirect_uri=postmessage
    cookie_policy=single_host_origin
    proxy=oauth2relay554026710
    *origin=http://www.pubandbar-network.co.uk*
    state=1995523240|0.4607792083184853
    display=page
    client_id=102180630313.apps.googleusercontent.com
    authuser=0
    
    0 讨论(0)
  • 2020-12-03 07:39

    If your client id, client secret, and your javascript origins url is correct you might want to check whether the port you're using is exactly the same with the url you put in for javascript origins. I mistyped mine by one digit: e, g localhost:888 instead of localhost:8888 and got that error because my javascript origins was localhost:8888 not 888

    0 讨论(0)
提交回复
热议问题