Sammdahamm
Sammdahamm

Reputation: 11

Google+ OAuth API - error 400

I'm having a bit of a problem with the Google+ authentication and I can't seem to get my head around it.

I'm running a page on a WAMP server on my local machine. The website is being hosted on localhost:80

I setup the OAuth credentials as follows:

REDIRECT URIS  
http://localhost:80/oauth2callback

JAVASCRIPT ORIGINS 
http://localhost:80

So the callback and JS origin are both tuned to localhost:80 (as far as I'm aware).

However, when I use the Google+ signin button, I click on my Google account, but then am greeted with the following error message.

400. That’s an error.

Error: origin_mismatch

Request Details
=
from_login=1

e=3100077

scope=https://www.googleapis.com/auth/plus.login

redirect_uri=postmessage

state=886354831|0.2093651692

origin=http://localhost

as=6ab1e337782cd5f6

pli=1

request_visible_actions=http://schema.org/AddAction

hl=en

response_type=code token id_token gsession

cookie_policy=single_host_origin

proxy=oauth2relay1316100299

include_granted_scopes=true

client_id=/blanked this part for security/-jsaproji1sk0u1b8kjlh3m3n4i232m4b.apps.googleusercontent.com

authuser=0
That’s all we know.

Which outlines that the error is due to origin_mismatch. I've tried setting the OAuth origin&redirect credentials to localhost and localhost:80 respectively, but both give an error 400

Could someone with a bit more experience give me a hand? I'm still quite new to this

Thanks in advance, Sam

Upvotes: 0

Views: 1649

Answers (1)

dragonfire
dragonfire

Reputation: 702

Did you try setting the javascript origins also to: http://localhost not just http://localhost:80?

The origins must be an exact match, and in your query it doesn't contain the port number as part of the origin.

You can add multiple origins by adding one per line.
- Dragonfire

Upvotes: 1

Related Questions