Headers
The publishable API key associated with your project. You can find this in
Project Settings. It’s a string
that starts with
pk_
.A string that uniquely identifies the user within your project. Ensure that
this is the ID that you use to identify the user in your system e.g. database
ID, Firebase Auth ID etc. Failing to do so may cause unexpected bugs and
errors in your application.
The HMAC hash for the user. See HMAC Authentication
for more details.
HMAC Authentication
HMAC authentication is a mechanism that provides an additional layer of security to ensure your client application can securely consume Proficient APIs. To enable HMAC authentication for a given project you simply need to go the Project Settings page on the dashboard and toggle it on. Once HMAC authentication is enabled, all Client API endpoints will require aX-PROFICIENT-USER-HMAC
header, and the requests that don’t include will be rejected with a 401
error.
While HMAC authentication is optional, we strongly recommend enabling it for
applications that have an authentication flow where user data is persisted
into your system. Disabling HMAC may pose a security risk where an end user
can access another user’s data.
Computing the HMAC hash
The HMAC hash is a string generated with the SHA-256 algorithm and digested with Base64. It is produced using your project’s HMAC secret as key and your user’s external ID as message.You can find the HMAC secret associated with your project in Project
Settings. It’s a string that
starts with
hsec_
.- Your frontend sends a request to your backend with the user’s external ID.
- Your backend authenticates the user using your authentication system.
- Your backend computes the hash and sends it back to your frontend.
- Your frontend can now access Proficient’s Client API with an additional
X-PROFICIENT-USER-HMAC
header.