Security
The menu dedicated to security asset management such as API Key, Server Key.
Use Server Key to securely authenticate your client with Amity Social Cloud server
With secure mode off, Amity SDK generates an access token on the client side when given a userId
and apiKey
. This can lead to malicious users abusing the endpoint and spying on someone else's session.
With secure mode on, an additional authentication token that is generated from your own backend server using a separate Server Key is required. You must turn on secure mode in your production system or the system will be vulnerable to such kind of attack.
How to generate a server key
Amity provides a way to get the server key easily via the ASC Console as followed:
Login to your ASC Console
Go to Setting -> Security
Enable secure mode via the toggle.

4. Click "Generate new server key" to generate your server key

5. Click Continue (please make sure you read the warning message and are aware of the impact)

6. The server key will be shown, please copy and securely store into your backend system. The key will only be shown once.

How to use server key to create auth token
Once secure mode is enabled and server key is generated, all client authentication request will require an authentication token and your backend server will need to make a server-to-server call, while passing server key into Amity Social Cloud server in order to get the authentication token. Please follow the following steps to generate auth token:

Client initiates a call to the backend.
Client's servers make a request to endpoint
https://api.<region code>.amity.co/api/v4/authentication/token
server key
anduserId
. Refer to the table below for the correct region code and endpoint.RegionRegion codeEndpointEurope
eu
https://api.eu.amity.co/
Singapore
sg
https://api.sg.amity.co/ or https://api.amity.co/
United States
us
https://api.us.amity.co/
Receive the auth token back and find a way to pass it up from server-side to client-side and give it to the SDK.
Use your auth token in your SDK
To use auth token on the client side, please see the Getting Started guide.
How to get API key
An API key will be provided when you create the application.
Open Amity Social Cloud Console.
On the left menu, select Settings to expand its submenu.
Select Security.
On the Security page, you will find the apiKey.

Authentication
There are 2 modes of Authentication:
Unsecure mode
Secure mode
Unsecure mode
With secure mode disabled, you can connect directly to the Amity server.
1. Call /api/v3/session using the API key and user id. Refer to Get API key section for the instructions on how to get the API key.
2. In the Responses, you will find that the server will return an access token in the Response body.
Secure Mode
With secure mode enabled, it provides an additional layer of security because it requires server-level authentication.
If Secure mode is enabled, you will need the server key. Refer to our documentation on How to generate the server key from console.
1. Call /api/v3/authentication/token using the server key.
2. The server will return an authentication token in the Response body.
3. Call /api/v3/session using the returned token.
4. In the Responses section, you will find that the server will return an access token in the Response body.
mTLS Certificate
Mutual Transport Layer Security or mTLS, is a two-way mutual authentication technique. It helps two parties to authenticate at both ends of a network if they have the correct private key. mTLS ensures that the people at both ends of a network connection are who they claim to be.
Authentication Token and Admin Token will be protected by mTLS and provide an extra layer of security.
How to Enable mTLS Certificate
In the Console, go to Settings > Security tab
Click +Create Certificate option to create the certificate
Specify the Certificate Name and Certificate Signing Request (CSR)

Activate the mTLS feature

Enabling the mTLS feature is optional.
Last updated
Was this helpful?