Skip to main content

Authorization API

This reference describes the Lumin 3P Authorization JavaScript Library API, which you can use to load authorization codes or access tokens from Lumin.

Method: lumin.auth.initialize

The initialize method initializes config for authorization flow

window.lumin.auth.initialize(config: AuthConfig)

Data type: AuthConfig

PropertiesTypeDescription
client_idstringRequired. Your application's client ID
scopestringRequired. A space-delimited list of scopes that identify the resources that your application want to access. Supported scopes are: openid, bananasign:document.create
response_typestringRequired. Which grant to execute. Available values are: code, code id_token, token, token id_token
noncestringA random string for ID tokens
statestringSpecifies any string value for prevent attacks and redirect users
redirect_uristringThe redirect_uri where authentication responses will be sent and received. It is one of the redirect URIs you registered in the Lumin Sign.
ux_modestringThe UX mode to use for the authorization flow. Valid values are popup and redirect. (Default: redirect)

Method: lumin.auth.signin

The signin method start the authorization flow with configuration in initialize step

window.lumin.auth.signin(option: SigninOption)

Data type: SigninOption (optional)

PropertiesTypeDescription
onSuccess(payload: SuccessPayload): voidThe JavaScript function that handles returned response
onError(payload: ErrorPayload): voidThe JavaScript function that handles error response

SuccessPayload

PropertiesTypeDescription
codestring(Authorization code flow) The authorization code of a successful token response.
access_tokenstring(Implicit flow) The access token of a successful token response.
id_tokenstring(OpenID Connect)The id token of a successful token response.
token_typestringThe type of the token issued.
statestringSpecifies any string value for prevent attacks and redirect users
scopestringA space-delimited list of scopes that identify the resources that your application want to access. Supported scopes are: openid, bananasign:document.create
expires_instringThe lifetime in seconds of the access token.
errorstring(Error of OAuth2 configuration) A single ASCII error code.
error_descriptionstring(Error of OAuth2 configuration) Human-readable ASCII text providing additional information

ErrorPayload

PropertiesTypeDescription
errorstringA single ASCII error code.
error_descriptionstringHuman-readable ASCII text providing additional information

Method: lumin.auth.signout

The signout method start the sign out OAuth2 flow with configuration in initialize step

window.lumin.auth.signout(option: SignoutOption)

Data type: SignoutOption (optional)

PropertiesTypeDescription
onSuccess(): voidThe JavaScript function that handles after sign out success
onError(payload: ErrorPayload): voidThe JavaScript function that handles error

ErrorPayload

PropertiesTypeDescription
errorstringA single ASCII error code.
error_descriptionstringHuman-readable ASCII text providing additional information