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()
@storyous/auth
1.2.0 • Public • PublishedReadme
Keywords
nonePackage Sidebar
Install
npm i @storyous/auth
Repository
Weekly Downloads
6
Version
1.2.0
License
ISC
Unpacked Size
31 kB
Total Files
15