Session-aware access tokens
Learn how to create session-aware access tokens.
Session-aware access tokens are essential for maintaining a consistent and seamless shopping experience in a Global Commerce environment. These tokens link the shopper session with the access token, enabling continuity and security across various stages of the shopping and checkout process. With session-aware access tokens, businesses can ensure user authentication, preserve shopper state, and facilitate smoother transitions, especially when moving between different platforms or third-party applications to the Digital River-hosted checkout.
You should use session-aware access tokens when maintaining a consistent shopper session is crucial, including:
Transitioning to checkout: When moving a shopper from a third-party application to a Digital River-hosted checkout, a session-aware token is required to link the shopper session.
Seamless user experience: Preserving the shopper's session state across different platforms and stages of the purchase process ensures a smooth and continuous workflow.
Security and authentication: This feature helps securely manage and validate the shopper's session, ensuring that access is legitimate and linked to an authenticated shopper.
Creating a session-aware access token
Creating a session-aware access token is crucial for maintaining a consistent and secure shopping experience across multiple platforms and stages of the eCommerce process. This guide will walk you through the steps needed to generate a session-aware token, ensuring that your shoppers' sessions remain intact and authenticated as they transition through different phases of their purchase journey. Whether moving a shopper from a third-party application to a Digital River-hosted checkout or simply striving for a seamless user experience, these instructions will help you implement session-aware tokens effectively.
To create a session-aware access token, follow these steps:
Choose the appropriate method: You can use either a browser call or a request to the Token endpoint in the Shopper API or the OAuth API.
If you provide a session token when generating an access token, the system creates a new shopper session.
Use the correct parameters: Depending on your workflow, use the
sessionToken
query or thedr_session_token
form parameters to request the session-aware token.Send the request: Include all necessary authentication details and parameters in your request to obtain the session-aware token.
When transitioning a shopper from a third-party application to a Digital River-hosted checkout experience, you must provide a session-aware token to complete an online purchase.
You can choose one of the following options to create a session-aware access token:
Creating an anonymous shopper token for a site with an API key
You may need to create an anonymous shopper token when integrating a third-party application with Digital River's checkout platform. This token allows limited access to the site and enables the shopper to browse and select items without requiring full authentication. It is particularly useful for providing a streamlined shopping experience. The following steps outline creating an anonymous shopper token using your site's API key.
Establish the token: Pass your API key to the
sessionToken
site action.Make the request: Ensure the
sessionToken
site action originates from the client's side (shopper's browser).
Here's an example using Ajax:
Creating an anonymous shopper token for a site via OAuth 2.0
Creating an anonymous shopper token via OAuth 2.0 involves generating a session token and obtaining an anonymous access token. This process helps maintain secure and limited access for users, ensuring their shopping experience is seamless and protected. Here, we'll guide you through the steps to achieve this by making precise AJAX calls to the appropriate endpoints.
Step 1: Get a dr_session_token from the sessionToken
site action with no API key
sessionToken
site action with no API keyTo get a dr_session_token
from the sessionToken
site action without an API key, use the following Ajax request:
Step 2: POST the dr_session_token to the oauth20 resource to get an anonymous shopper token
To use a dr_session_token
with the /oauth20/token
endpoint to get an anonymous shopper token, follow these steps:
Get the dr_session_token: Follow the instructions from Step 1 to obtain the
dr_session_token
.Send a POST request: Send the /oauth20/token and include the
dr_session_token
as the bearer.Retrieve the response: The response will include the
access_token
,token_type
,expires_in
, andrefresh_token
.
The time-to-live (TTL) value for expires_in
respects the user session site settings in Global Commerce. In this example, the token for the site expires in 86397 seconds (24 hours).
You can use this anonymous shopper token for further API interactions.
Last updated