Version 1.4 - Updated on 12/15/2016
authorize()
Authorize API call, used to start the OAuth 2.0 process. Can only be called after the API has been initialized with a client key, client secret, and callback URL. This API redirects the current page to the sign-in screen.
getAuthorizeUrl
Returns an authorization URL that a user can redirect to in order to start the Oauth 2.0 process.
init(initObject)
Initialization method used to setup the SDK. Must be the first API called.
initObject
— Lifecycle callbacks and parametersinitObject.clientKey
— Key for your applicationinitObject.clientSecret
— Secret for your applicationinitObject.callbackUrl
— Callback URL for your applicationinitObject.htmlEscape
— HTML escapes all responses when set. Defaults to true.InitObject.authToken
— Access token that may optionally be passed to bypass authentication. The SDK will run the postAuthenticated
callback and be in a logged in state if this parameter is set.initObject.refreshToken
— Refresh token that may optionally be passed with an access token. The SDK will automatically try to refresh if a token expires and a refresh token is present.initObject.postInitialize
— postInitialize
is called when the api is initialized and ready to be used. The callback contains a boolean value to let a client know if the API has been initialized successfully.initObject.postAuthenticated
— postAuthenticated
is called after the SDK has attempted to authenticate a user, either by exchanging an access token or receiving it in the init
method. The callback has two arguments, a boolean flag which is set when authentication was successful, and an error code which is set only when the SDK could not authenticate.initObject.onAuthInvalidated
— Method called after the SDK has received a 401.isAuthenticated()
Helper method that a client can use to check if the SDK has authenticated a user by completing the OAuth 2.0 process
boolean
value that is set if the SDK has successfully completed the OAuth 2.0 process.isInitted()
Helper method that you can use to check if the SDK has been successfully initialized.
boolean
value that is set if the SDK has been successfully initialized.ready(callback)
JQuery-like ready handler that can be used to execute code after init
completes.
callback
— Function that you can run when the SDK is ready for use. This function does not take any argument.token(requestObject)
Final part of the oauth 2.0 process. Exchanges an authorization code for access tokens. This API can only be called after thingspace.cloud.init()
has been called. This function is called automatically by the SDK when an authorization code is present in the URL. After success or failure, postAuthenticated
lifecycle method is called.
requestObject
— Callbacks and parametersrequestObject.success
— Success callback function. Returns the response in the first argument.requestObject.failure
— Failure callback function. Returns the response in the first argument.Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.