Introduction
Embedding a store or product pages inside your app doesn’t require authentication using private safe sessions. You can serve public stores that are open to anonymous visitors.
This method is used as an easy way for you to securely transfer information between your app and SideDish on the client. The decision on authentication is totally yours. If you don’t need to ensure validity of properties, you could pass all parameters unsafely. Both methods are easy to implement. We recommend authenticating usres, but if you don’t rely on any input from the user, and you manage purchases on your own, you can avoid authentication altogether.
- Authenticate users on SideDish. SideDish doesn’t create users on its own, but instead relies on the authentication of your app. This means that users don’t need to go through another login flow.
- Pass parameters from your app to SideDish safely.
@sidedish/core package with its createSession function.
Creating a session
Creatign safe sessions should be done on the server side, and never on the client side.
Make sure you never pass your secret API key or personal tokens to the client!
Store you want to use.
Any unique identifier of a user. We suggest you use your existing userId (may it be a uuid or an email). It is required because there is no point in creating a session without passing a user.
Object with any extra parameters you want to pass to SideDish.
Response
The
id of the safe sessionThe
expiresAt of the session in ISO stringAcceptable parameters
User data and user’s account
All butuserId are optional.
Pass this as your user id to be act upon.
Pass this to see user’s name in the dashboard, logs and analytics.
Anything you want to send for the user’s properties.Please note that if you pass
internal property in the user object, it will disable tracking and analytics for the user.id for the logged in user’s account. This is especially useful if your app is a B2B and you want to support account level features.Pass this to see account’s name in the dashboard, logs and analytics.
Anything you want to send for the account’s properties.
Purchases
If you are managing the purchases of products yourself, you can pass what are the products the user / account has installed.Array of
id strings or Objects that include id and data for the installationPurchase Type:Updating a session with new data
If you are managing the installation state and you want to update a session you could send new data with:The id of the session
Updated data
userId isn’t possible and you should just create a new session.
Revoking a session
Even though sessions are relatively short lived, you can still choose to revoke a session. This is useful if you want to log out a user.The id of the session