Skip Navigation

METHOD_SetOAuth2Token

This method sends a request to 
BEMS
 requesting a new token when a previous token that was sent through the METHOD_BeginSession expired. 
The following table describes the parameters that you can include in this method. 
Parameter
Type
Required
Description
oAuth2Token
String
This parameter specifies the new token that is created.  

BEMS
 response and notification

The following table describes the parameters that 
BEMS
 returns and the notification sent to the 
BlackBerry Connect
 app when a chat session is started.
Parameter
Type
Description
method
String
Returns the invoked method (for example, BeginSession).
state
String 
This parameter specifies the state of the request to 
BEMS
 (for example, Processing or Complete).
sessionid
String
This parameter specifies the session ID for the user. 

Code example

The following example sends a request to 
BEMS
 to generate a new access token.
{ "id":"c12", "method":"SetOAuth2Token", "params": { "oAuth2Token":"cwt=AAEBHAEFAAAAAAAFFQAAADtSBd...gNEA-id-_ZgS9ZvC" }, "jsonrpc":"2.0" }
If the request is successful, 
BEMS
 sends the following response and token to the 
BlackBerry Connect
 app.
{ "id":"c13", "method":"SetOAuth2Token", "result": { "status":"success" }, "state":"COMPLETE" "jsonrpc":"2.0" }