How to use oidc-client - 10 common examples

To help you get started, we’ve selected a few oidc-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jmurphzyo / Angular2OidcClient / src / app / shared / services / auth.service.ts View on Github external
response_type: 'id_token token',
  scope: 'openid email roles',

  silent_redirect_uri: 'http://localhost:4200/silent-renew.html',
  automaticSilentRenew: true,
  accessTokenExpiringNotificationTime: 4,
  // silentRequestTimeout:10000,

  filterProtocolClaims: true,
  loadUserInfo: true
};


@Injectable()
export class AuthService {
  mgr: UserManager = new UserManager(settings);
  userLoadededEvent: EventEmitter = new EventEmitter();
  currentUser: User;
  loggedIn = false;

  authHeaders: Headers;


  constructor(private http: Http) {

    this.mgr.getUser()
      .then((user) => {
        if (user) {
          this.loggedIn = true;
          this.currentUser = user;
          this.userLoadededEvent.emit(user);
        }
github skoruba / react-oidc-client-js / src / src / services / AuthService.ts View on Github external
constructor() {
    const settings = {
      authority: Constants.stsAuthority,
      client_id: Constants.clientId,
      redirect_uri: `${Constants.clientRoot}signin-callback.html`,
      silent_redirect_uri: `${Constants.clientRoot}silent-renew.html`,
      // tslint:disable-next-line:object-literal-sort-keys
      post_logout_redirect_uri: `${Constants.clientRoot}`,
      response_type: 'code',
      scope: Constants.clientScope
    };
    this.userManager = new UserManager(settings);

    Log.logger = console;
    Log.level = Log.INFO;
  }
github joewalling / ReactAdvantage / client / src / services / AuthService.js View on Github external
constructor() {
        const settings = {
            authority: `${process.env.REACT_APP_IDENTITY_SERVER_URI}`,
            client_id: `${process.env.REACT_APP_CLIENT_ID}`,
            redirect_uri: `${process.env.REACT_APP_URI}/authentication/callback`,
            silent_redirect_uri: `${process.env.REACT_APP_URI}/authentication/silentCallback`,
            post_logout_redirect_uri: `${process.env.REACT_APP_URI}/`,
            response_type: 'id_token token',
            scope: 'openid profile ReactAdvantageApi'
        };
        this.userManager = new UserManager(settings);

        Log.logger = console;
        Log.level = Log.INFO;
    }
github staticdeploy / staticdeploy / management-console / src / common / AuthService / OidcAuthStrategy / index.ts View on Github external
constructor(
        openidConfigurationUrl: string,
        clientId: string,
        baseRedirectUrl: string,
        providerName: string
    ) {
        this.userManager = new UserManager({
            authority: openidConfigurationUrl,
            client_id: clientId,
            redirect_uri: urlUtils.getRedirectUrl(baseRedirectUrl),
            silent_redirect_uri: urlUtils.getSilentRedirectUrl(baseRedirectUrl),
            scope: "openid profile",
            userStore: new WebStorageStateStore({ store: window.localStorage })
        });
        this.displayName = providerName;
    }
github IdentityModel / oidc-client-js / samples / Angular / App / src / app / app-auth-n.service.ts View on Github external
constructor() {
    var settings = {
      authority: Constants.stsAuthority,
      client_id: Constants.clientId,
      redirect_uri: `${Constants.clientRoot}assets/signin-callback.html`,
      silent_redirect_uri: `${Constants.clientRoot}assets/silent-callback.html`,
      post_logout_redirect_uri: `${Constants.clientRoot}`,
      response_type: 'id_token token',
      scope: Constants.clientScope
    };
    this._userManager = new UserManager(settings);
  }
github cloudscribe / sample-idserver / Tenant1SpaVueJs / ClientApp / components / nav-menu.vue View on Github external
data() {
    return {
      routes,
      collapsed: true,
      userManager: new UserManager(config),
      isAuthenticated: false,
      userName: ""
    };
  },
  created() {
github perarnborg / vuex-oidc / src / services / oidc-helpers.js View on Github external
export const createOidcUserManager = (oidcSettings) => {
  const oidcConfig = getOidcConfig(oidcSettings)
  requiredConfigProperties.forEach((requiredProperty) => {
    if (!oidcConfig[requiredProperty]) {
      throw new Error('Required oidc setting ' + requiredProperty + ' missing for creating UserManager')
    }
  })
  return new UserManager(oidcConfig)
}
github imodeljs / imodeljs / core / frontend / src / oidc / OidcBrowserClient.ts View on Github external
private async createUserManager(requestContext: FrontendRequestContext): Promise {
    const settings: UserManagerSettings = await this.getUserManagerSettings(requestContext);

    this._userManager = new UserManager(settings);
    this._userManager.events.addUserLoaded(this._onUserLoaded);
    this._userManager.events.addUserUnloaded(this._onUserUnloaded);
    this._userManager.events.addAccessTokenExpiring(this._onAccessTokenExpiring);
    this._userManager.events.addAccessTokenExpired(this._onAccessTokenExpired);
    this._userManager.events.addSilentRenewError(this._onSilentRenewError);
    this._userManager.events.addUserSignedOut(this._onUserSignedOut);

    return this._userManager;
  }
github AxaGuilDEv / react-oidc / packages / core / src / services / authenticationService.js View on Github external
export const authenticationService = config => {
  if (userManager) {
    return userManager;
  }
  userManager = new UserManager(config);
  return userManager;
};
github vietnam-devs / coolstore-microservices / src / web / back-office / src / services / AuthService.ts View on Github external
constructor() {
    const settings = {
      authority: `${process.env.REACT_APP_AUTHORITY}`,
      client_id: 'backoffice',
      redirect_uri: `${process.env.REACT_APP_ROOT_URL}/signin-callback.html`,
      //silent_redirect_uri: `${process.env.REACT_APP_ROOT_URL}/silent-renew.html`,
      post_logout_redirect_uri: `${process.env.REACT_APP_ROOT_URL}`,
      response_type: 'id_token token',
      scope: 'inventory_api_scope cart_api_scope catalog_api_scope rating_api_scope openid profile'
    }
    this.userManager = new UserManager(settings)

    Log.logger = console
    Log.level = Log.INFO
  }

oidc-client

OpenID Connect (OIDC) & OAuth2 client library

Apache-2.0
Latest version published 4 years ago

Package Health Score

52 / 100
Full package analysis

Popular oidc-client functions