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

@identifo/identifo-auth-js

v3.4.6

Published

Library for web-auth through Identifo

Downloads

167

Readme

Identifo.js

License: MIT

https://nodei.co/npm/@identifo/identifo-auth-js.png?downloads=true&downloadRank=true&stars=true

Browser library for authentication through Identifo.

Install

# Run this command in your project root folder.
# yarn
$ yarn add @identifo/identifo-auth-js

# npm
$ npm install @identifo/identifo-auth-js

Usage

Initialize

  import IdentifoAuth from '@identifo/identifo-auth-js';

  const identifo = new IdentifoAuth({
    url: 'http://localhost:8081', // URI of your Identifo server.
    appId: 'your app ID', // ID of application that you want to get access to.
  });

Parametrs

All parameters can be considered optional unless otherwise stated. Option | Type | Description --- | --- | --- url | string (required) | The url of your Identifo server. appId | string (required) | ID of application that you want to get access to. issuer | string | The issuer claim identifies the principal that issued the JWT. scopes | string [] | The default scopes used for all authorization requests. redirectUri | string | The URL where Identifo will call back to with the result of a successful authentication. It must be added to the "Redirect URLs" in your Identifo Application's settings. postLogoutRedirectUri | string | The URL where Identifo will call back to after a successful log-out. It must be added to the "Redirect URLs" in your Identifo Application's settings. tokenManager| TokenManager instance | The tokenManager provides access to client storage for specific purposes autoRenew| boolean | Renew tokens before they expire. By default autoRenew is false.

API

init()

Method which initialize your identifo instance and actualize your states. Call it before other methods.

handleAuthentication():Promise

Processing the received token. Call it on the redirect page to handle and verify token.

renewSession():Promise

Allows you to renew session manually. Returns new JWT.

identifo.renewSession().then((token) => {})

signin()

Redirect user to sign-in page. After successful sign-in you will be redirected to redirectUri

signup()

Redirect user to sign-up page. After successful sign-up you will be redirected to redirectUri

logout()

Logout and redirects back to postLogoutRedirectUri the user out of their current Identifo session and clears all tokens stored locally in the TokenManager. By default, the refresh token (if any) and access token are revoked so they can no longer be used.

getToken()

Returns token and token payload

{ token: 'JWT', payload: 'JWT payload' }

TokenManager

import IdentifoAuth, { SessionStorageManager } from '@identifo/identifo-auth-js';

const identifo = new IdentifoAuth({
    appId: 'your app ID',
    url: 'http://localhost:8081',
    tokenManager: new SessionStorageManager() // you can pass your custom key for storage. Bt default it`s identifo_access_token
  })

You can import SessionStorageManager | LocalStorageManager. By default it`s LocalStorageManager.

isAuth:boolean

Returns actual auth statis of the user.

const isAuth = identifo.isAuth;

redirectUri

The url that is redirected to when using identifo.signin or identifo signup methods. This must be listed in your Identifo application's redirect URLs. If no redirectUri is provided, defaults to the current url (window.location.href).

postLogoutRedirectUri

The url that is redirected to when using identifo.logout method. This must be listed in your Identifo application's redirect URLs. If not specified, user will be redirected to login page.

Author

madappgang

License

This project is licensed under the MIT license. See the LICENSE file for more info.