Angular-oauth2-oidc: Google OAUTH2

Created on 27 Sep 2017  路  2Comments  路  Source: manfredsteyer/angular-oauth2-oidc

Hi Guys,

Has anyone been able to use Google OAUTH2? I've tried referencing the following details onto the "auth.config.ts" but not having much luck.

https://accounts.google.com/.well-known/openid-configuration

Most helpful comment

Hi,

just tested it (after I've not used Google as an id provider directly for a while). It works.

You can try it out with the following config:

// This api will come in the next version

import { AuthConfig } from 'angular-oauth2-oidc';

export const googleAuthConfig: AuthConfig = {

  // Url of the Identity Provider
  issuer: 'https://accounts.google.com',

  // URL of the SPA to redirect the user to after login
  redirectUri: window.location.origin + '/index.html',

  // URL of the SPA to redirect the user after silent refresh
  silentRefreshRedirectUri: window.location.origin + '/silent-refresh.html',

  // The SPA's id. The SPA is registerd with this id at the auth-server
  clientId: '1004270452653-m396kcs7jc3970turlp7ffh6bv4t1b86.apps.googleusercontent.com',

  strictDiscoveryDocumentValidation: false,

  // set the scope for the permissions the client should request
  // The first three are defined by OIDC. The 4th is a usecase-specific one
  scope: 'openid profile email',

  showDebugInformation: true,
}

To test this, I've registered an application in the Google API Console. Its name is mentioned in the clientId property. I also had to set strictDiscoveryDocumentValidation to true.

Wishes,
Manfred

All 2 comments

Hi,

just tested it (after I've not used Google as an id provider directly for a while). It works.

You can try it out with the following config:

// This api will come in the next version

import { AuthConfig } from 'angular-oauth2-oidc';

export const googleAuthConfig: AuthConfig = {

  // Url of the Identity Provider
  issuer: 'https://accounts.google.com',

  // URL of the SPA to redirect the user to after login
  redirectUri: window.location.origin + '/index.html',

  // URL of the SPA to redirect the user after silent refresh
  silentRefreshRedirectUri: window.location.origin + '/silent-refresh.html',

  // The SPA's id. The SPA is registerd with this id at the auth-server
  clientId: '1004270452653-m396kcs7jc3970turlp7ffh6bv4t1b86.apps.googleusercontent.com',

  strictDiscoveryDocumentValidation: false,

  // set the scope for the permissions the client should request
  // The first three are defined by OIDC. The 4th is a usecase-specific one
  scope: 'openid profile email',

  showDebugInformation: true,
}

To test this, I've registered an application in the Google API Console. Its name is mentioned in the clientId property. I also had to set strictDiscoveryDocumentValidation to true.

Wishes,
Manfred

https://medium.com/@ishmeetsingh/google-auth-integration-with-angular-5-and-angular-oauth2-oidc-ed01b997e1df

Was this page helpful?
0 / 5 - 0 ratings

Related issues

godhar picture godhar  路  3Comments

PandaaAgency picture PandaaAgency  路  3Comments

jeroenheijmans picture jeroenheijmans  路  3Comments

prmces picture prmces  路  4Comments

zulander1 picture zulander1  路  4Comments