NbOAuth2AuthStrategy

OAuth2 authentication strategy.

Strategy settings:

export enum NbOAuth2ResponseType {
  CODE = 'code',
  TOKEN = 'token',
}

export enum NbOAuth2GrantType {
  AUTHORIZATION_CODE = 'authorization_code',
  PASSWORD = 'password',
  REFRESH_TOKEN = 'refresh_token',
}

export class NbOAuth2AuthStrategyOptions {
  name: string;
  baseEndpoint?: string = '';
  clientId: string = '';
  clientSecret: string = '';
  clientAuthMethod: string = NbOAuth2ClientAuthMethod.NONE;
  redirect?: { success?: string; failure?: string } = {
    success: '/',
    failure: null,
  };
  defaultErrors?: any[] = ['Something went wrong, please try again.'];
  defaultMessages?: any[] = ['You have been successfully authenticated.'];
  authorize?: {
    endpoint?: string;
    redirectUri?: string;
    responseType?: string;
    requireValidToken: true,
    scope?: string;
    state?: string;
    params?: { [key: string]: string };
  } = {
    endpoint: 'authorize',
    responseType: NbOAuth2ResponseType.CODE,
  };
  token?: {
    endpoint?: string;
    grantType?: string;
    requireValidToken: true,
    redirectUri?: string;
    scope?: string;
    class: NbAuthTokenClass,
  } = {
    endpoint: 'token',
    grantType: NbOAuth2GrantType.AUTHORIZATION_CODE,
    class: NbAuthOAuth2Token,
  };
  refresh?: {
    endpoint?: string;
    grantType?: string;
    scope?: string;
    requireValidToken: true,
  } = {
    endpoint: 'token',
    grantType: NbOAuth2GrantType.REFRESH_TOKEN,
  };
}
NbPasswordAuthStrategy
Previous page
NbDummyAuthStrategy
Next page

Need some help or found an issue?

Ask on Stack Overflow with tag `nebular` or post an issue on GitHub.