Open MikeWizzard opened 7 years ago
Hello, this might be a bit late but here you go for others reference, since you're adding "hd" optionalUrlParams, you will need simply to give it a value so my call if i was you will be the following:
$authProvider.google({
hd: 'example.com',
clientId: 'xxxxxxxxxxx.apps.googleusercontent.com',
});
this.providers = {
google: {
name: 'google',
url: '/auth/google',
authorizationEndpoint: 'https://accounts.google.com/o/oauth2/auth',
redirectUri: window.location.origin,
requiredUrlParams: ['scope'],
optionalUrlParams: ['display', 'hd'],
hd: "<your hd>"
scope: ['profile', 'email'],
scopePrefix: 'openid',
scopeDelimiter: ' ',
display: 'popup',
oauthType: '2.0',
popupOptions: { width: 452, height: 633 },
state: function () { return encodeURIComponent(Math.random().toString(36).substr(2)); }
}
};
Good luck, hope it helps.
I need to restrict login with google to a specific domain but unfortunatly it still lets me login with any email this is the following code i have.
$authProvider.google({ hd: 'example.com', clientId: 'xxxxxxxxxxx.apps.googleusercontent.com', });
this.providers = { google: { name: 'google', url: '/auth/google', authorizationEndpoint: 'https://accounts.google.com/o/oauth2/auth', redirectUri: window.location.origin, requiredUrlParams: ['scope'], optionalUrlParams: ['display', 'hd'], scope: ['profile', 'email'], scopePrefix: 'openid', scopeDelimiter: ' ', display: 'popup', oauthType: '2.0', popupOptions: { width: 452, height: 633 }, state: function () { return encodeURIComponent(Math.random().toString(36).substr(2)); } } };
is there something wrong or missing? also i cannot see the email when logged in with google on the profile page. i only get image and display name.
Thanks in advance