sahat / satellizer

Token-based AngularJS Authentication
https://satellizer-sahat.rhcloud.com
MIT License
7.85k stars 1.13k forks source link

Sign in With Google Plus Error: redirect_uri_mismatch #578

Open ashokhirpara1 opened 9 years ago

ashokhirpara1 commented 9 years ago

I am using following virtual host name for domain in Authorized redirect URIs but still gives error with

Error: redirect_uri_mismatch

Application: Demo

You can email the developer of this application at: ashokhirpara00768@gmail.com

The redirect URI in the request: http://ashok.com did not match a registered redirect URI.

screenshot_3

jlien-calwater commented 9 years ago

@ashokhirpara1 I had the same issue and found the issue is either the route or the configuration.

So you can try adding "http://askok.com" as the authorized redirect URIs. See if that helps since the callback is defaulted to the site root.

See default configurations.

// Google
$authProvider.google({
  url: '/auth/google',
  authorizationEndpoint: 'https://accounts.google.com/o/oauth2/auth',
  redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,
  requiredUrlParams: ['scope'],
  optionalUrlParams: ['display'],
  scope: ['profile', 'email'],
  scopePrefix: 'openid',
  scopeDelimiter: ' ',
  display: 'popup',
  type: '2.0',
  popupOptions: { width: 452, height: 633 }
});

You can append it like so:

// Google
$authProvider.google({
  redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host + '/' + oauth2callback,
});
mukeshp004 commented 7 years ago

This worked for me