Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor.js Google Oauth issues

Tags:

oauth

meteor

I am trying to setup my Meteor app to use Google logins, Here is my setup in the /server/config.js file

Accounts.loginServiceConfiguration.remove({
service: "google"
  });


Accounts.loginServiceConfiguration.insert({
service: "google",
clientId: "XXXXXXX",
secret: "XXXXXX"
  });

I have the setup on google pointed to localhost:3000 I have accounts-ui and accounts-google installed on my meteor app.

and I see the google login button on my app's homepage but when I click it I get:

Error: redirect_uri_mismatch The redirect URI in the request: 
http://localhost:3000/_oauth/google?close 
did not match a registered redirect URI
like image 490
glasses Avatar asked Jul 31 '13 02:07

glasses


2 Answers

I'm using Nitrous.io since I am developing on Windows. This article explains why google sees the wrong URI.

https://github.com/shoebappa/vagrant-meteor-windows/issues/9

Basically you need to launch meteor with a modified ROOT_URL so that it doesn't start with localhost.

Replace localhost.meteor.com with the URL that meteor is actually running at. ROOT_URL=http://localhost.meteor.com meteor

like image 141
JoshJoe Avatar answered Nov 26 '22 17:11

JoshJoe


You have to register the redirect URL with Google's APIs Console. Log on to the console and check what redirect URI was set up. Add localhost if necessary

Update:

I tried it myself and added

 http://localhost:3000/_oauth/google?close 

in the API console. I added accounts-google and accounts-ui to the Hello World app and added the login button to the page

<body>
    {{loginButtons}}
    {{> hello}}
</body>

I agreed to the requested permissions in the pop up and was logged in.

like image 29
hknust Avatar answered Nov 26 '22 15:11

hknust