You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x
refreshUserToken
Refresh an authenticated user token in SAP Commerce Cloud.
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(
context: SapccIntegrationContext
): Promise<OAuthUserTokenResponse>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
context | Required | SapccIntegrationContext |
Returns
Returns a representation of an OAuthUserTokenResponse.
Referenced Types
Examples
Refreshing a user token.
import { sdk } from '~/sdk';
const tokenResponse = await sdk.commerce.refreshUserToken();