JS SDK for Iris Auth Manager
npm install @iris-platform/iris-aum-js-sdk```
npm i @iris-platform/iris-aum-js-sdk
`
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';
`
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.
`
`
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.
`
`
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.
`
`
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.
`
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.
`
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.
`
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.
`
`
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.
`
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.
`
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(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.
`
`
decodeToken(token)
token – valid Iris JWT 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.
`
`
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.
`
`
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.
`
``
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.
`
`
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.
`
```
let irisAuth = require("@iris-platform/iris-aum-js-sdk")
let authMgr = irisAuth.AuthManagerFactory({"authMgrApiUrl": "
.then(data => console.log(data))
.catch(error => console.log(error))