npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@iris-platform/iris-aum-js-sdk

v1.0.2

Published

JS SDK for Iris Auth Manager

Downloads

47

Readme

Iris AUM JS SDK

Introduction

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

npm i @iris-platform/iris-aum-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 Iris JWT token. The registration API validates provided token and uses the user information to create Iris user and returns JWT token that then can be used to access all other Iris 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 'iris-aum-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 Iris token accept the ones obtained with anonymous login.

userInformation(token, successCallback, errorCallback)

token – Iris 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 – Iris 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 Iris token accept the ones obtained with anonymous login.

validateUserAccessToken(token, successCallback, errorCallback)

token – Iris 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 – Iris 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 Iris 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 Iris 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 Iris 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 Iris 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 Iris JWT access token.

Logout

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

logout(token, successCallback, errorCallback)

token – Iris 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 – Iris JWT token

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

Decode Iris JWT

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

decodeToken(token)

token – valid Iris 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 @iris-platform/iris-aum-js-sdk you can test it out with the following code:

let irisAuth = require("@iris-platform/iris-aum-js-sdk")
let authMgr = irisAuth.AuthManagerFactory({"authMgrApiUrl": "<iris 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))