npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@plantimer/nativescript-auth0

v1.1.1

Published

Plugin wrapper for Auth0. It uses InAppBrowser and SecureStorage to safely authenticate users.

Downloads

31

Readme

@plantimer/nativescript-auth0

npm install @plantimer/nativescript-auth0

How does it work ?

The only workflow currently supported is the Authorization Code Grant with PKCE with a refresh token.

This will not work if you haven't enabled the refresh token setting !

Following the diagram given in the Auth0 docs, the flow is as follows:

  • The user is redirected to the Auth0 login page with a PKCE challenge
  • The user logs in and is redirected back to the app with an access code
  • The stores the refresh token fetched using the access code, the PKCE challenge and the PKCE verifier
  • The app fetches the access token using the refresh token

Usage

This plugin uses the InAppBrowser plugin to open the Auth0 login page and the NativeScript Secure Storage plugin to store tokens.

Vanilla

import { Auth0 } from '@plantimer/nativescript-auth0';

const config = {
  auth0Config: {
    domain: 'mydomain.auth0.com', // Domain name given by Auth0 or your own domain if you have a paid plan
    clientId: 'ClIenTiDgIvEnByAuTh0', // Client ID given by Auth0
    audience: 'https://your.audience.com', // Often a URL
    redirectUri: 'schema:///', // The app's schema (set in AndroidManifest.xml and Info.plist)
  },
  browserConfig: {
    // InAppBrowser configuration
  }
}

Auth0.setUp(config).signUp("[email protected]"); // Optional hint to pre-fill the email field
Auth0.setUp(config).signIn();
Auth0.setUp(config).getAccessToken();

Angular Example

// *.component.ts
import { NativescriptAuth0 } from '@plantimer/nativescript-auth0';

@Component({
  selector: 'ns-app',
  template: '<Button (tap)="login()">Login</Button>',
})
export class AppComponent {
  login() {
    const config = {
      auth0Config: {
        domain: 'mydomain.auth0.com', // Domain name given by Auth0 or your own domain if you have a paid plan
        clientId: 'ClIenTiDgIvEnByAuTh0', // Client ID given by Auth0
        audience: 'https://your.audience.com', // Often a URL
        redirectUri: 'schema:///', // The app's schema (set in AndroidManifest.xml and Info.plist)
      },
      browserConfig: {
        // InAppBrowser configuration
      }
    }

    Auth0.setUp(config).signUp("[email protected]"); // Optional hint to pre-fill the email field
    Auth0.setUp(config).signIn();
    Auth0.setUp(config).getAccessToken();
  }
}

Enable deep linking

Deep linking is the ability for the app to open when a link is clicked. This is required for the redirectUri to work.

Please follow the InAppBrowser documentation to enable deep linking (i.e. set the schema).

Ideas and issues

If you have any ideas, issues or security concerns, please open an issue !

License

This repository is available under the MIT License.