1.2.0 • Published 10 days ago

@storyous/auth v1.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
10 days ago

auth

Usage of saltAuth

import { createSaltAuth } from '@storyous/auth';

const config = {
    identityBaseUrl: 'https://identity.cloud.saltpay.co',
    clientId: process.env.SALTID_CLIENT_ID,
    clientSecret: process.env.SALTID_CLIENT_SECRET,
    redirectUris: ['https://login.storyous.com/api/auth/salt-id-callback'],
    customRequestTimeout: 10000
};

// see @storyous/logger
const log = initLogger(config.env, config.logging).module('saltAuth');

const saltAuth = createSaltAuth(config, log);

// During application bootstrapping,
// you have the option to set a timeout for the init function,
// allowing it to retry before throwing an error.
// If no timeout is specified, the default timeout of 30 seconds is used.
await saltAuth.init(20);

// authorize request to a service behind API Gateway
const accessToken = saltAuth.getAccessToken();
const headers = {
    'Authorization': `Bearer ${accessToken}`;
};

// get an additional OAuth client
const client = await saltAuth.createClient()
1.2.0

10 days ago

1.1.1

1 month ago

1.1.0

1 month ago

1.0.5

3 months ago

1.0.4

3 months ago

1.0.3

3 months ago

1.0.2

1 year ago

1.0.1

2 years ago