@jfront/oauth-core
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

oauth-core

Core functionality for OAuth 2.0 connection.

Usage

import { OAuth } from "@jfront/oauth-core"

const oauth = new OAuth(
  "clientId",
  "http://localhost/app/oauth",
  "http://localhost/authorize",
  "http://localhost/token",
  "http://localhost/logout",
  window.sessionStorage,
)

API

authorize

Authorization Code/Implicit flow authorization.

oauth.authorize("code", "http://localhost/app/view")

getTokenWithAuthCode

Get token with authorization code, when authorization step was completed.

oauth.getTokenWithAuthCode("authorization_code", "random_nonce_string")

refreshToken

Refresh access token, if you have refresh_token.

oauth.refreshToken("refresh_token")

getTokenWithUserCredentials

Get token with user login/password.

oauth.getTokenWithUserCredentials("login", "password")

logout

Logout for client-side apps.

oauth.getTokenWithUserCredentials("http://localhost/app/view")

Readme

Keywords

none

Package Sidebar

Install

npm i @jfront/oauth-core

Weekly Downloads

0

Version

0.3.0

License

Apache-2.0

Unpacked Size

151 kB

Total Files

50

Last publish

Collaborators

  • botnet-unit-273
  • capcrs
  • alexanderlapygin
  • alexsav94
  • dmitrii92