You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x
signUserIn
Method initializing an authenticated user session in SAP Commerce Cloud.
This method sends a POST request to the OAuthUserAuthorization endpoint of the Alokai Middleware. In turn, it retrieves an access token from the of the SAP OAuth server. The token is saved in the browser as the vsf-sap-token cookie automatically using the Set-Cookie response header. The default options of the cookie can be modified through the property in middleware.config.js.
You might also want to see the signUserOut method.
Signature
export declare function signUserIn<Res extends OAuthUserTokenResponse = OAuthUserTokenResponse,
Props extends OAuthUserAuthenticationProps = OAuthUserAuthenticationProps>(
props: Props,
options?: MethodOptions
): Promise<Res>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | Props | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
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
Signing a user in.
import { sdk } from '~/sdk';
const tokenResponse = await sdk.commerce.signUserIn({
username: 'test@gmail.com',
password: 'test123!'
});