@bvndle/sso-client
v0.1.4
Published
Sign up with Bvndle SSO Client
Readme
Bvndle SSO Client
Sign up with Bvndle SSO Client. See Onboard Partners to use Bvndle Partner services.
Quick start
Install
npm install @bvndle/sso-client
# or
yarn add @bvndle/sso-clientUsage
import { initBvndleClient } from "@bvndle/sso-client";
const SSO_CLIENT = initBvndleClient({
env: "<ENV>",
clientId: "<YOUR_CLIENT_ID>",
scope: "<SCOPE>",
deviceType: "<DEVICE_TYPE>",
image: "<AVATAR_FORMAT>",
});
const App = () => {
SSO_CLIENT.handler({
onSuccess: (token) => {
// Do something with the token
},
onError: (err) => {
// Do something with the error
},
});
return (
<button type="button" onClick={SSO_CLIENT.signIn}>
Sign in with Bvndle
</button>
);
};Merge user account with Bvndle
const onMergeAccount = () => {
SSO_CLIENT.mergeAccount({
userId: "<USER_ID>",
redirectUrl: "<REDIRECT_URL>",
});
};
<button type="button" onClick={onMergeAccount}>
Merge Account
</button>;Initializing Bvndle SSO Client initBvndleClient:
| Param | Type | Description |
| :--------- | :--------------------------------- | :------------------------------------------------------------------------------------- |
| env | dev | prod | Environment you want to use. |
| clientId | string | Client ID created after partner registration. |
| scope | email | fullname | profile | (optional) Determines the user data that is returned. Default is profile. |
| deviceType | web | mobile | (optional) Determines the type of redirectUrl returned. Default is web. |
| image | base64 | (optional) Determines whether you want the avatar in base64 format. Default is null. |
Merging user account with Bvndle mergeAccount:
| Param | Type | Description |
| :---------- | :------- | :--------------------------------------------------- |
| userId | string | The registered user ID with the partner application. |
| redirectUrl | string | (optional) The redirect URL after merge account. |
