How to use nativescript-oauth2 - 10 common examples

To help you get started, we’ve selected a few nativescript-oauth2 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 alexziskind1 / nativescript-oauth2 / demo / app / auth-service.ts View on Github external
function configureOAuthProviderMicrosoft(): TnsOaProvider {
  const microsoftProviderOptions: TnsOaProviderOptionsMicrosoft = {
    openIdSupport: "oid-full",
    clientId: "f376fa87-64a9-49a1-8b56-e0d48fc0810b",
    // redirectUri: "urn:ietf:wg:oauth:2.0:oob",
    redirectUri: "msalf376fa87-64a9-49a1-8b56-e0d48fc0810b://auth",
    urlScheme: "msalf376fa87-64a9-49a1-8b56-e0d48fc0810b",
    scopes: ["https://outlook.office.com/mail.read"]
  };
  const microsoftProvider = new TnsOaProviderMicrosoft(
    microsoftProviderOptions
  );
  return microsoftProvider;
}
github alexziskind1 / nativescript-oauth2 / demo-angular / src / app / auth-providers-helper.ts View on Github external
export function configureOAuthProviderMicrosoft(): TnsOaProvider {
    const microsoftProviderOptions: TnsOaProviderOptionsMicrosoft = {
        openIdSupport: "oid-full",
        clientId: "f376fa87-64a9-49a1-8b56-e0d48fc0810b",
        // redirectUri: "urn:ietf:wg:oauth:2.0:oob",
        redirectUri: "msalf376fa87-64a9-49a1-8b56-e0d48fc0810b://auth",
        urlScheme: "msalf376fa87-64a9-49a1-8b56-e0d48fc0810b",
        scopes: ["openid", "https://outlook.office.com/mail.read"]
    };
    const microsoftProvider = new TnsOaProviderMicrosoft(
        microsoftProviderOptions
    );
    return microsoftProvider;
}
github alexziskind1 / nativescript-oauth2 / demo / app / auth-service.ts View on Github external
export function tnsOauthLogin(providerType) {
  client = new TnsOAuthClient(providerType);

  client.loginWithCompletion((tokenResult: ITnsOAuthTokenResult, error) => {
    if (error) {
      console.error("back to main page with error: ");
      console.error(error);
    } else {
      console.log("back to main page with access token: ");
      console.log(tokenResult);
    }
  });
}
github alexziskind1 / nativescript-oauth2 / demo-angular / src / app / auth.service.ts View on Github external
public tnsOauthLogin(providerType): Promise {
    this.client = new TnsOAuthClient(providerType);

    return new Promise((resolve, reject) => {
      this.client.loginWithCompletion(
        (tokenResult: ITnsOAuthTokenResult, error) => {
          if (error) {
            console.error("back to main page with error: ");
            console.error(error);
            reject(error);
          } else {
            console.log("back to main page with access token: ");
            console.log(tokenResult);
            resolve(tokenResult);
          }
        }
      );
    });
github alexziskind1 / nativescript-oauth2 / demo / app / auth-service.ts View on Github external
function configureOAuthProviderFacebook(): TnsOaProvider {
  const facebookProviderOptions: TnsOaProviderOptionsFacebook = {
    openIdSupport: "oid-none",
    clientId: "691208554415645",
    clientSecret: "d8725ac416fa1bb1917ccffd1670e3c6",
    redirectUri: "https://www.facebook.com/connect/login_success.html",
    scopes: ["email"]
  };
  const facebookProvider = new TnsOaProviderFacebook(facebookProviderOptions);
  return facebookProvider;
}
github alexziskind1 / nativescript-oauth2 / demo-angular / src / app / auth-providers-helper.ts View on Github external
export function configureOAuthProviderFacebook(): TnsOaProvider {
    const facebookProviderOptions: TnsOaProviderOptionsFacebook = {
        openIdSupport: "oid-none",
        clientId: "691208554415645",
        clientSecret: "d8725ac416fa1bb1917ccffd1670e3c6",
        redirectUri: "https://www.facebook.com/connect/login_success.html",
        scopes: ["email"]
    };
    const facebookProvider = new TnsOaProviderFacebook(facebookProviderOptions);
    return facebookProvider;
}
github alexziskind1 / nativescript-oauth2 / demo / app / auth-service.ts View on Github external
function configureOAuthProviderGoogle(): TnsOaProvider {
  const googleProviderOptions: TnsOaProviderOptionsGoogle = {
    openIdSupport: "oid-full",
    clientId:
      "932931520457-buv2dnhgo7jjjjv5fckqltn367psbrlb.apps.googleusercontent.com",
    redirectUri:
      "com.googleusercontent.apps.932931520457-buv2dnhgo7jjjjv5fckqltn367psbrlb:/auth",
    urlScheme:
      "com.googleusercontent.apps.932931520457-buv2dnhgo7jjjjv5fckqltn367psbrlb",
    scopes: ["email"]
  };
  const googleProvider = new TnsOaProviderGoogle(googleProviderOptions);
  return googleProvider;
}
github alexziskind1 / nativescript-oauth2 / demo-angular / src / app / auth-providers-helper.ts View on Github external
export function configureOAuthProviderGoogle(): TnsOaProvider {
    const googleProviderOptions: TnsOaProviderOptionsGoogle = {
        openIdSupport: "oid-full",
        clientId:
            "932931520457-buv2dnhgo7jjjjv5fckqltn367psbrlb.apps.googleusercontent.com",
        redirectUri:
            "com.googleusercontent.apps.932931520457-buv2dnhgo7jjjjv5fckqltn367psbrlb:/auth",
        urlScheme:
            "com.googleusercontent.apps.932931520457-buv2dnhgo7jjjjv5fckqltn367psbrlb",
        scopes: ["email"]
    };
    const googleProvider = new TnsOaProviderGoogle(googleProviderOptions);
    return googleProvider;
}
github alexziskind1 / nativescript-oauth2 / demo / app / auth-service.ts View on Github external
export function configureOAuthProviders() {
  const microsoftProvider = configureOAuthProviderMicrosoft();
  const googleProvider = configureOAuthProviderGoogle();
  const facebookProvider = configureOAuthProviderFacebook();

  configureTnsOAuth([microsoftProvider, googleProvider, facebookProvider]);
}
github alexziskind1 / nativescript-oauth2 / demo-angular / src / app / auth-providers-helper.ts View on Github external
export function configureOAuthProviders() {
    const microsoftProvider = configureOAuthProviderMicrosoft();
    const googleProvider = configureOAuthProviderGoogle();
    const facebookProvider = configureOAuthProviderFacebook();
    const identityServer = configureOAuthProviderIdentityServer();

    configureTnsOAuth([microsoftProvider, googleProvider, facebookProvider, identityServer]);
}

nativescript-oauth2

OAuth 2 generic authorization plugin for NativeScript that doesn't install third party native libraries

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis