You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x
refreshUserToken
Method refreshing an authenticated user token in SAP Commerce Cloud.
This method sends a POST request to the OAuthUserTokenRefresh endpoint of the Alokai Middleware. In turn, it sends a request to the of the SAP OAuth server to refresh the access token stored as the vsf-sap-token browser cookie. The refreshed access token is saved in the cookie automatically using the Set-Cookie response header. The default options of the cookie can be modified through the property in middleware.config.js.
Signature
export declare function refreshUserToken<Res extends OAuthUserTokenResponse = OAuthUserTokenResponse>(
options?: MethodOptions
): Promise<Res>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
options | Optional | MethodOptions | Options that can be passed to additionally configure the request or customize the logic in a plugin. |
Returns
Returns a representation of an OAuthUserTokenResponse.
Referenced Types
Examples
Refreshing a user token.
import { sdk } from '~/sdk';
const tokenResponse = await sdk.commerce.refreshUserToken();