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

@taretmch/capacitor-auth0

v5.0.0-beta.5

Published

Native Auth0 SDK wrapper for capacitor

Downloads

93

Readme

@taretmch/capacitor-auth0

Native Auth0 SDK wrappter for capacitor

Install

npm install @taretmch/capacitor-auth0
npx cap sync

For iOS

Setup Auth0 domain & clientId at ios/App/App/Auth0.plist.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>ClientId</key>
    <string>{AUTH0_CLIENT_ID}</string>
    <key>Domain</key>
    <string>{AUTH0_DOMAIN}</string>
</dict>
</plist>

Setup Custom URL Scheme at Info.plist.

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
        </array>
    </dict>
</array>

capacitor-auth0 uses Auth0.swift internally. For more information, see Auth0.swift quickstart guide.

For Android

Setup Auth0 domain & clientId at android/app/src/main/res/values/strings.xml.

<?xml version='1.0' encoding='utf-8'?>
<resources>
    <string name="com_auth0_domain">{AUTH0_DOMAIN}</string>
    <string name="com_auth0_client_id">{AUTH0_CLIENT_ID}</string>
</resources>

Add manifestPlaceholders at android/app/build.gradle.

android {
    ...
    defaultConfig {
        ...
        manifestPlaceholders = [auth0Domain: "@string/com_auth0_domain", auth0Scheme: "demo"]
    }
}

capacitor-auth0 uses Auth0.Android internally. For more information, see Auth0.Android quickstart guide.

For Web

capacitor-auth0 has no implementation for web. You can use auth0-spa-js instead.

API

Capacitor Auth0 Plugin

load()

load() => Promise<Auth0User>

Load auth0 plugin. Get the authenticated user profile and update the credentials using the refresh token if the access token is expired. For android, initialize the plugin with your Auth0 configuration. Return undefined if the user is not authenticated.

Returns: Promise<Auth0User>


login()

login() => Promise<Auth0User>

Web Auth: Login with Auth0.

Returns: Promise<Auth0User>


logout()

logout() => Promise<void>

Web Auth: Logout from Auth0.


isAuthenticated()

isAuthenticated() => Promise<{ result: boolean; }>

Check if the user is authenticated.

Returns: Promise<{ result: boolean; }>


getUserInfo()

getUserInfo() => Promise<Auth0User>

Get the authenticated user profile. If the access token is expired, yield new credentials using the refresh token. Throws an error if the user is not authenticated.

Returns: Promise<Auth0User>


getCredentials()

getCredentials() => Promise<Credentials>

Get credentials and yield new credentials using the refresh token if the access token is expired. Return undefined if the user is not authenticated.

Returns: Promise<Credentials>


Interfaces

Auth0User

Auth0 user profile.

| Prop | Type | Description | | ----------- | ------------------- | ----------- | | id | string | User ID. | | name | string | User name. | | email | string | User email. |

Credentials

Auth0 credentials.

| Prop | Type | Description | | ------------------ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | | idToken | string | Identity token that contains user profile information. | | accessToken | string | Access token for Auth0 API. | | expiresAt | string | Access token expiration date. Once expired, the access token can no longer be used to access an API and a new access token needs to be obtained. | | scope | string | Granted scopes for the access token. Undefined if no scope is granted. | | refreshToken | string | Refresh token that can be used to request a new access token without signin again. Undefined if no refresh token is granted. | | tokenType | string | Type of received token. |