@daisycon/oauth-cli-client
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Daisycon oAuth CLI client

Installation

Using yarn

yarn add @daisycon/js-oauth-client

Using npm

npm install @daisycon/js-oauth-client

Usage in your code

To start the oAuth request in your initial starting page add the following snippit

import {OauthService, PkceService} from '@daisycon/js-oauth-client';

const oAuthService: OauthService = new OauthService(new PkceService());
oAuthService.startAuthorizationRequest(YOUR_CLIENT_ID, YOUR_AUTHORIZED_REDIRECT_URI);

Then on the authorized redirect URI add the following snippet. Then store the returned tokens somewhere safe.

import {AccessTokenResponseInterface, OauthService, PkceService} from '@daisycon/js-oauth-client';

const oAuthService: OauthService = new OauthService(new PkceService());
const accessTokens: AccessTokenResponseInterface = oAuthService.startAccessTokenExchange(YOUR_CLIENT_ID, YOUR_AUTHORIZED_REDIRECT_URI);
console.log(accessTokens);

Running as CLI script

After installation, you can run the client as follows

npx daisycon-oauth-cli --clientId=CLIENT_ID --clientSecret=CLIENT_SECRET --outputFile="./tokens.json"

Readme

Keywords

Package Sidebar

Install

npm i @daisycon/oauth-cli-client

Weekly Downloads

46

Version

1.0.4

License

ISC

Unpacked Size

394 kB

Total Files

96

Last publish

Collaborators

  • sadrichem
  • chris-schardijn
  • mdaisycon
  • m.vanderwereld
  • barrykampstra