Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@555platform/author-js-sdk

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@555platform/author-js-sdk

JS SDK for 555 Auth Manager

  • 1.0.4
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Author JS SDK

Introduction

This section describes JavaScript SDK for 555 Auth Manager. Package can be installed with

npm i @555platform/author-js-sdk

Registration – Social Media, Cima, SSO, or PingID

This API requires valid Facebook, Google, Cima, PingID access token. The API will exchange the given access token for 555 JWT token. The registration API validates provided token and uses the user information to create 555 user and returns JWT token that then can be used to access all other 555 platform APIs.

mediaRegister(type, mediaToken, successCallback, errorCallback)


type – LOGIN_TYPE_FACEBOOK, LOGIN_TYPE_GOOGLEPLUS, LOGIN_TYPE_PINGID, LOGIN_TYPE_SSO, LOGIN_TYPE_CIMA
mediaToken – token
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.
mediaRegisterAsync(type, mediaToken)


type – LOGIN_TYPE_FACEBOOK, LOGIN_TYPE_GOOGLEPLUS, LOGIN_TYPE_PINGID, LOGIN_TYPE_SSO, LOGIN_TYPE_CIMA
mediaToken – token

Returns promise that returns JSON payload on success and error on failure.

To get constants import them like this:

import {
  LOGIN_TYPE_FACEBOOK,
  LOGIN_TYPE_GOOGLEPLUS,
  LOGIN_TYPE_PINGID,
  LOGIN_TYPE_SSO,
  LOGIN_TYPE_CIMA
} from 'author-js-sdk';

Registration – Email

Register using email.

emailRegister(username, email, password, successCallback, errorCallback)

username – user name like first name and last name with optional middle name
email – user’s email
password – user’s password
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.
emailRegisterAsync(username, email, password)

username – user name like first name and last name with optional middle name
email – user’s email
password – user’s password

Returns promise that returns JSON payload on success and error on failure.

Registration – Device

Register using device unique id.

emailRegister(typeId, successCallback, errorCallback)

typeId - device uunique id
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.
emailRegisterAsync(typeId)

typeId - device uunique id

Returns promise that returns JSON payload on success and error on failure.

Get User Information

This API allows to get user information associated with JWT token. This API can be used with any 555 token accept the ones obtained with anonymous login.

userInformation(token, successCallback, errorCallback)

token – 555 JWT access token
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.
userInformationAsync(token)

token – 555 JWT access token

Returns promise that returns JSON payload on success and error on failure.

Validate Access Token

This API will validate if the token is valid. This API can be used with any 555 token accept the ones obtained with anonymous login.

validateUserAccessToken(token, successCallback, errorCallback)

token – 555 JWT access token
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.
validateUserAccessTokenAsync(token)

token – 555 JWT access token

Returns promise that returns JSON payload on success and error on failure.

Returns if the token is valid or not.

Login - Social Media, SSO, Cima or PingID

Login using social media, SSO, Cima or PingID.

mediaLogin(type, mediaToken, successToken, errorCallback)

type – LOGIN_TYPE_FACEBOOK, LOGIN_TYPE_GOOGLEPLUS, LOGIN_TYPE_PINGID, LOGIN_TYPE_SSO, LOGIN_TYPE_CIMA
mediaToken – token
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.
mediaLoginAsync(type, mediaToken)

type – LOGIN_TYPE_FACEBOOK, LOGIN_TYPE_GOOGLEPLUS, LOGIN_TYPE_PINGID, LOGIN_TYPE_SSO, LOGIN_TYPE_CIMA
mediaToken – token

Returns promise that returns JSON payload on success and error on failure.

Returns 555 JWT access token.

Email Login

Login using email.

emailLogin(email, password, successCallback, errorCallback)

email – user’s email
password – user’s password
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.
emailLoginAsync(email, password)

email – user’s email
password – user’s password

Returns promise that returns JSON payload on success and error on failure.

Returns 555 JWT access token.

Email Account Password Change

Change password for email based user account.

emailAccountPasswordChange(token, email, currentPassword, newPassword, successCallback, errorCallback)

token – bearer token, it can be client or server
email – user’s email
currentPassword – user’s current password
newPassword – user’s new password
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.
emailAccountPasswordChangeAsync(token, email, currentPassword, newPassword)

token – bearer token, it can be client or server
email – user’s email
currentPassword – user’s current password
newPassword – user’s new password

Returns promise that returns JSON payload on success and error on failure.

Device Login

Login using device unique id.

deviceLogin(typeId, successCallback, errorCallback)

typeId - device uunique id
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.
deviceLoginAsync(typeId, successCallback, errorCallback)

typeId - device uunique id

Returns promise that returns JSON payload on success and error on failure.

Returns 555 JWT access token.

Server Login

Get server to server JWT

serverLogin(successCallback, errorCallback)

successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.
deviceLoginAsync(successCallback, errorCallback)

Returns promise that returns JSON payload on success and error on failure.

Returns 555 server to server JWT access token.

Anonymous Login

This API allows anonymous login. This is useful if applications that do not require concept of user.

anonymousLogin(userID, successCallback, errorCallback)

userID – optional string with user name or id.  It can be empty.
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.
anonymousLoginAsync(userID)

userID – optional string with user name or id.  It can be empty.

Returns promise that returns JSON payload on success and error on failure.

Returns 555 JWT access token.

Logout

Logout API takes valid 555 JWT and adds it to blacklist so it cannot be used further to access 555 platform.

logout(token, successCallback, errorCallback)

token – 555 JWT token
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.
logoutAsync(token)

token – 555 JWT token

Returns promise that returns JSON payload on success and error on failure.

Decode 555 JWT

This API will return object with decoded JWT’s header, claims and signature.

decodeToken(token)

token – valid 555 JWT token

Following APIs are only available in v1.1

Refresh Token

APIs to retrieve new token with refresh token.

refreshTokenAsync(refreshToken)

refreshToken - refresh token
refreshToken(refreshToken, successCallback, errorCallback)

refreshToken - refresh token
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.

Revoke Refresh Token

Revoke specified refresh token

revokeRefreshTokenAsync(refreshToken)

refreshToken - refresh token
revokeRefreshToken(refreshToken, successCallback, errorCallback)

refreshToken - refresh token
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.

Update User Profile

This API allows for attaching profile to specified user. Profile can be arbitrary JSON object.

updateUserProfileAsync(token, userID, profileObject)

token - server to server token
userID - user id
profileObject - JSON object with profile data
updateUserProfile(token, userID, profileObject, successCallback, errorCallback)

token - server to server token
userID - user id
profileObject - JSON object with profile data
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.

Query users based on their profile data

Find users based on query of profile data. For example,

const queryObject = {
  'user_name': newUserName,
}

will search for user whose profile contains user_name equal to newUserName

queryUserProfileAsync(token, queryObject, isMatch, start, limit)

token - server to server token
queryObject - JSON object with query
isMatch - true to match field with value exactly, false will search for value contained in the field
start - pagination start index
limit - pagination count of entries returned
queryUserProfile(token, queryObject, isMatch, start, limit, successCallback, errorCallback)

token - server to server token
queryObject - JSON object with query
isMatch - true to match field with value exactly, false will search for value contained in the field
start - pagination start index
limit - pagination count of entries returned
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.

Delete User

Delete user with given user_id

deleteUserAsync(token, userID)

token - server to server token
userID - user id
deleteUser(token, userID, successCallback, errorCallback)

token - server to server token
userID - user id
successCallback – when API succeeds this callback will receive JSON response.
failureCallback – in case of failure error information will be passed into this callback.

Example

After you npm i @555platform/author-js-sdk you can test it out with the following code:

let Auth = require("@555platform/author-js-sdk")
let authMgr = Auth.AuthManagerFactory({"authMgrApiUrl": "<555 auth manager url>", "apiVersion": "v1.1", "appkey": "<your app key>", "appsecret": "<your app secret"})
authMgr.anonymousLogin("Some Name")
.then(data => console.log(data))
.catch(error => console.log(error))

THIS REPO IS IMPORTTED FROM https://github.com/555platform/iris-aum-js-sdk

https://www.npmjs.com/package/@iris-platform/iris-aum-js-sdk USED in IRIS-DOCUMENT-STORE as npm package.

Keywords

FAQs

Package last updated on 21 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc