🔑Single Sign-On
All it takes is a few lines of code added to your website!
Let your users access your Spot through your own authentication source, without creating a separate MeltingSpot account.
MeltingSpot offers two SSO authentication modes, each independently enabled from your Spot's settings (Settings > Single Sign-On):
Authorization URL SSO: MeltingSpot redirects the user to your login page, which then redirects them back to MeltingSpot with a signed token.
Programmatic SSO: Your backend or our SDKs exchange a signed token directly for a session, with no browser redirection.
Generate an SSO token
Whether you use the "Authorization URL" mode or the "Programmatic" mode, you need to generate a JSON Web Token (JWT) signed with HS256 using your Spot's SSO secret key.
Install JWT library
First, you'll have to install a library that allows you to create the token embedding your user's information.
npm install --save jsonwebtokenpip install PyJWTcomposer require firebase/php-jwtdotnet add package System.IdentityModel.Tokens.Jwt
dotnet add package Microsoft.IdentityModel.Tokens
dotnet add package Newtonsoft.JsonCreate the token
Next, you'll have to prepare a signed JWT defining some or all available user information. You'll have to use the private key copied from the Spot settings.
const jwt = require('jsonwebtoken');
const privateKey = 'YOUR_PRIVATE_KEY';
function createToken(user) {
const userData = {
sub: user.id, // Your own user ID
firstName: user.firstName,
lastName: user.lastName,
email: user.email,
title: user.title, // optional
avatarUrl: user.avatarUrl, // optional
lang: user.lang, // optional
timezone: user.timezone, // optional
groups: {
join: ["groupsId",...],
leave: ["groupsId",...],
}, //optional
domains: {
// Embed URLs to add or replace, by key
set: {
default: "https://app.acme.com/academy",
customContext: "https://www.acme.com/community",
},
// Keys to remove
unset: ['oldContext'],
}, //optional
customPropertiesValues: {
"customPropertiesSlug1": ["valueSlug",...],
"customPropertiesSlug2": value,
}, //optional
};
return jwt.sign(userData, privateKey, { algorithm: "HS256" });
}You can use all the following fields in the JWT:
sub
string
(required)
The ID of the user in your product or platform. This value will be stored as an external ID in MeltingSpot. It should be 255 characters or less.
firstName
string
(required)
The first name of the user. It should be 255 characters or less.
lastName
string
(required)
The last name of the user. It should be 255 characters or less.
email
string
(required)
The email of the user. This email address is considered as a verified address. You should make sure you've verified it on your side. It should be 255 characters or less and follow a valid email address format.
title
string
The job title of the user in plain text format.
avatarUrl
string
A full URL to the user's profile picture. It should include https:// or http://. You should make sure it's a valid URL on your side.
lang
string
The default locale to apply in the application. Currently, MeltingSpot supports:
enfor Englishfrfor Frenchdefor DeutschIf not specified or invalid, it will default to
en.
timezone
string
The default timezone to apply in the application. If not specified or invalid, it will default to Europe/Paris.
iat
number
The issue time of the JWT.
exp
number
The expiration time of the JWT. Although this value is not required, it's highly recommended to set it to 60 seconds from now. If not set, the token will be valid forever and can introduce security issues.
groups:join
string[]
The groups to which you want to add the member. Simply retrieve the id of the groups in question from the group selection menu of the audience table.
groups:leave
string[]
The groups whose members you wish to remove. Simply retrieve the id of the groups in question from the group selection menu in the audience table.
customPropertiesValues
property type
If you have custom properties, you can specify the value these properties will take on for the member.
domains: set
object
If you have embedded the Spot into several domains, specify the embed URLs the member should be redirected to, as a { key: URL } object (50 keys maximum, 255 characters maximum per URL).
The keys passed are added or replaced at each SSO login; other keys already stored are kept. The member will be redirected to the URL of the default key when clicking on a notification email. Learn more
domains: unset
string[]
The keys of the embed URLs to remove from the member (URL of a software for which the member no longer has a license, website whose URL has changed...), 50 keys maximum.
unset is applied after set: a key present in both is removed.
Mode 1: Authorization URL SSO
This mode delegates login to your own authentication page via a browser redirection. There are 2 main user journeys:
Your user clicks on a link in your app to enter your Spot.
Clicking on this link triggers the creation of a signed token (see above).
Your app redirects the user to your Spot and passes the token along.
If we can validate the token, we log the user in and identify them using the information passed in the token (like their name and email address).
A user who clicks on
LoginorJoinon your Spot (go.meltingspot.io/spot/...) will be redirected to a page on your website (theauthorisation URL, see below).On your app, the user will need to login or sign up.
Your app will generate a signed token (see how to above).
Your app will redirect the user to your Spot and pass the token along.
If we can validate the token, we log the user in and identify them using the information passed in the token (like their name and email address).

Implementation
1. Enable JWT SSO in your Spot settings
First, you will need to activate the SSO in your Spot settings :
Add an authorisation URL. It is the URL of the page where the user is redirected to be authenticated on your side (2nd bullet point in the "From your Spot" flow). 👀 If you want to run local tests, use
127.0.0.1in the URL, aslocalhostURLs are blocked by our system.Copy your private key.
Turn SSO on once you are ready.

You will need to create a custom signed link for your app that would automatically pass information to your Spot, such as: the email, first and last name of the member you want to log in.
2. Generate a token
See the section above.
3. Redirection to MeltingSpot
Once the user token has been created, you need to redirect the user to a URL by passing the token as a parameter. This URL is supplied to you as a parameter (redirectUrl) when the user lands on your authorization URL. Basically, it looks like this:
You need to add the token as a parameter as follows:
In most cases, the redirect URL we provide (redirectUrl) also contains a referrerUrl parameter that returns the user to the page they were on when they logged in in SSO mode.
You can force the value of this parameter, but to be valid, the value must represent a path relative to https://go.meltingspot.io and your Spot (e.g. ?referrerUrl=/spot/129487c9-6acc-43d9-ab96-182ded763538/lives).
Embed / widgets + SSO = ❤️
Once SSO authentication has been set up for your Spot, you can pass on the JWT token authenticating the user in the Spot embed or widget installation scripts. This will enable every user in your space to access the embed or widget with a connected status. When displaying your Spot in embed, your members will no longer have to click on 'Continue with SSO' to sign up or log in 😉
To do this, you need to add the authToken parameter to the embed or widget installation script parameters.

Mode 2: Programmatic SSO
This mode lets your backend or our Coach SDK exchange a signed token directly for a MeltingSpot session, with no browser redirection.
Configuration
In the "Programmatic SSO" tab of the SSO settings, there's only one setting: a Enable programmatic authentication (SDK) switch.
Using auto-join in the Coach SDK
Once this mode is enabled, pass the generated JWT token (see "Generating a token" above) as authToken to our Coach SDK, and add the autoJoin flag:
The Coach re-authenticates the user with this token, then calls the auto-join API on your behalf, passing it the same signed JWT. The Spot derives first name, last name, email, groups, domains and custom properties directly from the token's claims — no need to send them again separately.
Good to know
Do I need to enable both modes? No, they're independent. Enable "Authorization URL" if you want a classic SSO login button on your site; enable "Programmatic" if you're integrating our SDKs or calling our API directly. Nothing stops you from enabling both in parallel.
Do I need to generate a different token for auto-join? No. It's exactly the same JWT, with the same claims and the same secret key as for classic programmatic authentication. The only difference is the
autoJoin: trueoption on the Coach SDK side.In Programmatic mode, why is my user authenticated but not a member of the Spot? In "Programmatic" mode, authentication and joining the Spot are two separate steps (unlike "Authorization URL" mode, where they're automatically linked). Use
autoJoin: trueon the Coach SDK, or handle joining separately via your integration.In Programmatic mode, what happens if a member has already been rejected or deactivated? Auto-join follows the existing status transition rules: it won't "unblock" a rejected or deactivated member. The member must be in a state that allows acceptance for auto-join to succeed.
What happens when a user joins a Spot via SSO? Regardless of the mode used, as long as the token is valid: if the member doesn't exist, we create a new user based on the information passed in the token and log them in. If they already exist, we log them in without updating their profile information (first name, last name, title, avatar…). However, the
groups,domainsandcustomPropertiesValuesparameters of the token are applied at each login.What happens to existing users when I enable SSO? Regardless of the mode: if you enable SSO while you already have registered members on your Spot, no problem — they can keep using their current credentials (email + password). They'll also be able to log in via SSO and add this identification method to their profile, as long as the email associated with their SSO account matches the one used on the Spot.
My Spot is private, how are sign-ups handled in SSO mode? In "Authorization URL" mode: since the user goes through your login page before joining the Spot, we consider they've already been validated by you — they're automatically accepted, even if the Spot is private. In "Programmatic" mode, this isn't automatic: authentication alone doesn't make the user join the Spot. With
autoJoin: true, the member is added following the usual status transition rules (a member who has already been rejected or deactivated won't be unblocked) — so it isn't a guaranteed acceptance like in redirect mode.What happens if a user changes their email in my application? The next time they log in to the Spot, we'll treat them as a new user. If they want to access their old profile on the Spot, they'll need to log in via email + password.
Can I decide the landing page a member opens when they log in via SSO? Yes! When one of your users accesses your Spot from your application, you can use the
referrerUrlparameter to send them to any page on your Spot.How are handled members' status (Invited / Pending / Declined / Rejected / Deactivated / Left) when they join / reconnect to a Spot with SSO? -> Check it here!
Mis à jour
Ce contenu vous a-t-il été utile ?