Skip to content

Documentation / react-auth / useToken

Function: useToken() ​

useToken(callbacks?): Object

Use this hook to tap into access token grant and revoke events.

Parameters ​

• callbacks?: Object

• callbacks.onAccessTokenGranted?: (params) => void

Callback that will execute when a user's access token is granted.

Param The user's access token

• callbacks.onAccessTokenRemoved?: () => void

Callback that will execute when a user's access token is removed.

Returns ​

Object

getAccessToken - returns the user's current access token

getAccessToken ​

getAccessToken: () => Promise<null | string>

Returns ​

Promise<null | string>