2.0.0 • Published 12 months ago

@berlingske-media/bm.node-module.user-api-sdk v2.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
12 months ago

Berlingske-Media user api-type instance SDK

This repository contains SDK for user API instances signed with OAuth 2.0 Bearer token.

Usage

Available currently only for backend -> backend communication, usage would be as follows

import { configure, isErrorResponse } from '@berlingske-media/bm.node-module.user-api-sdk';
import { getAccessToken } from '@berlingske-media/bm.node-module.auth_plugin';

const authToken = getAccessToken();

const sdk = configure(
    'https://user-service-api-qa1.usersegment.idm.aws.berlingskemedia-testing.net',
    authToken,
    'source_service_name',
);

const result = await sdk.getBySSOUID('db1d8395d96f473984ea2f7ab947dcf8');

if (isErrorResponse(result)) {
    console.log(result.errorCode);
} else {
    console.log(result.body);
}