2.0.10 • Published 8 months ago

@elfsquad/authentication v2.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Elfsquad Authentication Library

The authentication library allows you to easily authenticate with the Elfsquad API.

Options

  • clientId identifier of your OpenIdClient that can be obtained in the integrations page of your Elfsquad Management System.
  • redirectUri callback entry point of your app.
  • scope (optional) Requested authentication scope. Defaults to Elfskot.Api offline_access.
  • loginUrl (optional) URL of the authentication service. Defaults to https://login.elfsquad.io.

Methods

  • signIn starts the authentication flow.
  • onSignIn returns a promise that is called after the authentication flow has run successfully.
  • isSignedIn returns a promise with a boolean result that indicates if the user is signed in.

Examples

import { AuthenticationContext } from "@elfsquad/authentication";

var authenticationContext = new AuthenticationContext({
  clientId: "c2a349a9-02ea-4e1e-a59d-65870529f713",
  redirectUri: "https://example.com",
});

authenticationContext
  .onSignIn()
  .then(() => {
    authenticationContext.getAccessToken().then((accessToken) => {
      console.log("accessToken", accessToken);
    });
  })
  .catch((error) => {
    console.error(error);
  });

authenticationContext.isSignedIn().then((isSignedIn) => {
  if (!isSignedIn) {
    authenticationContext.signIn();
  }
});
2.0.10

8 months ago

2.0.9

1 year ago

2.0.7

1 year ago

2.0.8

1 year ago

2.0.5

2 years ago

2.0.6

2 years ago

2.0.3

2 years ago

2.0.4

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

2.0.0

2 years ago

1.0.9

3 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.12

2 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago