0.5.2 • Published 2 years ago

bsso v0.5.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Bloomberg SSO js utilities

NPM Version Build Status Code Climate Test Coverage

Install

yarn add bsso

! Usage with react native !

First setup react-native-get-random-values and react-native-webview-crypto and react-native-url-polyfill.

Simple Usage

import { BSSO } from 'bsso';

const bsso = new BSSO({
  clientId: 'se-mobile-app',
  redirectUri: 'http://localhost:8080/'
});

const tokenFromRedirectUrl = new URLSearchParams(window.location.hash).get('#token');
	
if (tokenFromRedirectUrl) {
  // if we have #token, we are ready for redirect
  console.log('redirect');
  window.location.replace(await bsso.getRedirectURL(tokenFromRedirectUrl));
} else {
  const code = new URLSearchParams(window.location.search).get("code");

  if (code) {
    // if we have the code, we are ready to continue getting token for authorization
    const activeToken = await bsso.getToken(code);
    console.log('activeToken', activeToken);
  }
}

BSSO API

MethodArgumentsReturn
getTokencode?: stringstring
isExpiredboolean
getRedirectURLtoken: string, scope?: stringstring
toJSONobject
0.5.2

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago