14

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

4 Answers 4

7

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

6

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.

1
  • In the google console I have: ` Client ID: **** Email address: **** Client secret:**** Redirect URIs: localhost:3000 JavaScript origins: localhost:3000 ` Still not working, thanks for replying, do you have any other ideas?
    – glasses
    Commented Aug 1, 2013 at 1:37
2

Another idea : Did you removed the autopublish ? If so, you must publish the userData so your client can access to Users.

1
  • 1
    I misspelled autopublish while removing and this was causing the issue. Now its resolved. Commented Sep 12, 2015 at 16:15
1

I have the same problem on https://gotlog.in When I put https://gotlog.in/_oauth/google?close as the call back URL it get worth :

  1. That’s an error. Error: invalid_client no application name

And whe I put the good call back (https://gotlog.in/_oauth/google) as said in the setup popup I get the same :

  1. That’s an error. Error: redirect_uri_mismatch The redirect URI in the request: https://gotlog.in/_oauth/google?close did not match a registered redirect URI.

My root URL is setup and valid, but I have no userData published. But the documantation says : "By default, the current user's username, emails and profile are published to the client."

Edit: found the solution here : https://github.com/meteor/meteor/issues/2717

I was missing the consent screen information in the api console. And yes the callback URL has to have the '?close' at the end. Viva Meteor =)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.