Skip to content

Instantly share code, notes, and snippets.

@Ch3shireDev
Created January 13, 2020 14:56
Show Gist options
  • Select an option

  • Save Ch3shireDev/ab0a100bcfa8e30eabf1ab351e6195fc to your computer and use it in GitHub Desktop.

Select an option

Save Ch3shireDev/ab0a100bcfa8e30eabf1ab351e6195fc to your computer and use it in GitHub Desktop.
Angular OAuth2 connection
import { APP_INITIALIZER, NgModule } from '@angular/core';
import { AuthConfig, OAuthModule } from 'angular-oauth2-oidc';
import { InitialAuthService } from './initial-auth.service';
const origin = 'http://localhost:4200';
const issuer = 'https://dev-09ixy5yn.auth0.com';
const clientId = 'FuDdsYDpESTGjE4BWcAE4l0F8Ebc8SjI';
// const issuer = 'https://philly-vanilly.auth0.com';
// const clientId = 'r4gL1ntxR2lnodnu81WFnWNOWdO5SFuV';
const configAuthZero: AuthConfig = {
issuer: `${issuer}/`,
customQueryParams: { audience: `${issuer}/api/v2/` },
redirectUri: `${origin}/`,
silentRefreshRedirectUri: `${origin}/`,
clientId,
scope: 'openid profile email',
clearHashAfterLogin: true,
showDebugInformation: true,
requireHttps: false,
};
configAuthZero.logoutUrl =
`${configAuthZero.issuer}v2/logout?client_id=${configAuthZero.clientId}&returnTo=${encodeURIComponent(configAuthZero.redirectUri)}`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment