Reference Source
import WLAuthorizationManager from 'react-native-ibm-mobilefirst'
public class | source

WLAuthorizationManager

This class manages the OAuth interaction between the device and the authorization server.

Method Summary

Public Methods
public

Clears the provided access token.

public

async login(securityCheck: string, credentials: Object): Promise<string>

Logs in to the specified security check.

public

async logout(securityCheck: string): Promise<string>

Logs out of a specified security check

public

Initiates the OAuth flow with the MobileFirst server to get an access token for the specified resource scope.

Public Methods

public clearAccessToken(scope: string) source

Clears the provided access token. Note: When failing to access a resource with an obtained token, call the clearAccessToken method to clear the invalid token before calling WLAuthorizationManager.obtainAccessToken to obtain a new access token.

Params:

NameTypeAttributeDescription
scope string

The scope whose access token must be cleared.

public async login(securityCheck: string, credentials: Object): Promise<string> source

Logs in to the specified security check.

Params:

NameTypeAttributeDescription
securityCheck string

The security check to log into.

credentials Object

Credentials for logging in to the security check in JSON format.

Return:

Promise<string>

Empty string if success. If failed, the error object with additional failure information.

public async logout(securityCheck: string): Promise<string> source

Logs out of a specified security check

Params:

NameTypeAttributeDescription
securityCheck string

The security check to log out of

Return:

Promise<string>

Empty string if success. If failed, the error object with additional failure information.

public async obtainAccessToken(scope: string): Promise<string> source

Initiates the OAuth flow with the MobileFirst server to get an access token for the specified resource scope.

Params:

NameTypeAttributeDescription
scope string

Scope for which the access token is to be returned.

Return:

Promise<string>

If success, the access token string for the resource scope. If failed, the error object with additional failure information.