2

This is all for a local development environment (in OS X) and I have:

  1. local nginx with a virtual host
  2. the app being served properly on myapp.dev (being proxied to localhost:3000)
  3. Google app created
  4. ServiceConfiguration.configurations properly setting service, clientId, loginStyle and secret

But when clicking on the google button to sign in I get:

  1. That’s an error.

Error: redirect_uri_mismatch

Application: MyApp

You can email the developer of this application at: blah@example.com

The redirect URI in the request: http://localhost:3000/_oauth/google did not match a registered redirect URI.

It's technically correct because since Google do not accept to put specific IP addresses for the callback (only localhost or some domain), I needed to setup as callback http://myapp.dev/_oauth/google so I can use it from the mobile device.

The problem seems to be related to accounts trying to redirect localhost:3000 instead of myapp.dev

I don't know how to setup accounts to use this domain, or maybe is a global way to tell that meteor app that it should use the myapp.dev domain

A solution to this would be a solution to any development environment setup for Meteor mobile apps. Thanks

Sebastian Sastre
  • 2,034
  • 20
  • 21

1 Answers1

3

google.js uses absoluteUrl() to create the callback URL so setting this in the startup of the client should give you the callback you wanted:

Meteor.startup(function () {
  // Client startup method.
  Meteor.absoluteUrl.defaultOptions.rootUrl = 'http://myapp.dev/';
});
Sebastian Sastre
  • 2,034
  • 20
  • 21
  • Thanks alot this works for me. However cant seem to get it to work with Ngrok. [link](http://stackoverflow.com/questions/39860152/how-do-use-ngrok-in-conjunction-with-google-oauth?noredirect=1#). any ideas are greatly appreciated with bounty! – SirBT Oct 10 '16 at 07:22
  • @SirBT take a look, maybe what I answered there helps. good luck! – Sebastian Sastre Oct 10 '16 at 21:01