SSO allows your users to sign into Commenze through your own custom authentication.
You need to have a Commenze business subscription to have access to SSO. If you are currently on the free trial you have access for your trial period.
Go to the main dashboard then to the dashboard for your site that you wish to enable SSO for.
From there navigate to Settings using the side bar and tick the checkbox in the SSO section.
Your site is now SSO enabled.
To connect your users to Commenze (sign them in) you need to make a POST request to the following endpoint:
The POST request should contain the following data:
| Parameter | Value | Description | Required |
|---|---|---|---|
| string | The email is used as the unique identifier for the user. | Yes | |
| username | string | The username is what will be displayed on the Comment section for that user. | Yes |
| expiresIn | integer | The amount of milliseconds that the user will stayed signed in for. Its best to match this up with the value you use for your own user cookies, so the user will automatically be signed out of Commenze when they are signed out of your site. | Yes |
| hostname | string | The hostname identifier provided by Commenze for your site. To find this again go here. | Yes |
| secret | string | The secret given on the SSO section in the settings for your site. | Yes |
| profilePicture | string | The profile picture for the user to be used on the comment section. | No |
Node.js example:
await fetch("https://api.commenze.com/api/auth/sso/connect", {
method: "POST", true,
body: JSON.stringify({
email, username, expiresIn, hostname, secret
}),
headers: { "Content-Type": "application/json" },
credentials: "include"
});
To disconnect a user (sign them out) you need to make a POST request to the following endpoint:
The POST request should contain the following data:
| Parameter | Value | Description | Required |
|---|---|---|---|
| string | The unique identifier of the user you wish to sign out of Commenze | Yes | |
| hostname | string | The hostname identifier provided by Commenze for your site. To find this again go here. | Yes |
| secret | string | The secret given on the SSO section in the settings for your site. | Yes |