Anonymous tokens
Content
Using Anonymous Sessions for Guest Checkout We want your feedback Join our User Research Program To implement a guest checkout, the commercetools platform offers the possibility to assign carts and orders to an anonymous session, and later assign those to a customer account on sign in or sign up.
To follow this tutorial, you should have a project set up, as described in Getting Started.
If you want to use the special OAuth access tokens, you should know how to work with Password Flow tokens as described in this tutorial. This identifier can be freely chosen, and you could re-use an identifier given to you by an analytics library or a Device ID on a mobile device.
However, if you do not use the OAuth access tokens to manage the session for you, you need to make sure that no other session with that identifier already exists. Using Anonymous Sessions with special OAuth tokens Using OAuth tokens has the advantage that carts created with the My Carts endpoint are automatically assigned to the session, and that the My Customers Profile endpoint assigns the carts and orders automatically to the customer account during sign up and sign in.
Copy or download the anonymous tokens credentials, they anonymous tokens be revealed after creation for security reasons. Creating a token with a new Anonymous Session We use the OAuth client we just created to get a token.
In this example, we let the API generate an identifier for us. If this identifier is already in use, the request will fail.