Skip to main content

OpenID Connect Integration

The OpenID Connect integration lets participants log in to a campaign with your own login system, so their registration details come from their verified profile instead of being typed in by hand.

Written by Andreas Grosen

How it works

OpenID Connect (OIDC) is an open standard for logging in. Your login system, called the identity provider, confirms who the participant is and sends Playable a signed ID token with their profile details.

  1. The participant clicks a login button in your campaign.

  2. They are sent to your identity provider and log in there.

  3. Your identity provider sends them back to the campaign with an ID token.

  4. We check the token's signature and expiry, then store it in a cookie in the participant's browser.

  5. The registration fields you have mapped are hidden, and their values are taken from the token when the participant registers.

You can also require the login, so only participants who have logged in can register.

Before you start

You need three things in place: an application registered with your identity provider, its OpenID configuration, and a registration page as the first page of your campaign.

From your identity provider

  • A Client ID for the application, and a Client secret if your identity provider requires one.

  • The OpenID configuration, either as a URL or as JSON. The URL usually ends in /.well-known/openid-configuration.

What the configuration must contain

Field

Requirement

authorization_endpoint

Required.

response_types_supported

Must include id_token or code.

response_modes_supported

Must include form_post.

id_token_signing_alg_values_supported

Required.

claims_supported

Required. These are the profile fields you can map to registration fields.

jwks_uri

Recommended. We use it to fetch your signing keys. Without it, you paste an RSA public key and only RS256 is supported.

token_endpoint

Needed when you use the code response type.

Redirect URI to allow

Add this redirect URI to the application at your identity provider:

https://<your campaign domain>/api/authenticate/redirect

Use the domain of your campaign link. To test the login from the demo link, also add the same path on the demo link's domain.

Note! We always ask for the response as form_post. Your identity provider sends the participant back with an HTTP POST to the redirect URI.

In your campaign

The registration page must be the first page in the campaign flow. We move it there when you save the configuration, and it can't be moved while the integration is set up.

Add the OpenID Connect integration

  1. Go into the Integrations tab on your campaign and select Add Integration.

  2. Select Misc. and find OpenID Connect in the list.

  3. Under Configuration type, choose how to give us your OpenID configuration:

    • URL: enter the address in Configuration URL.

    • Paste: paste the JSON into Configuration JSON.

  4. Select Save configuration. When it is accepted, you see the message "A configuration is now active" and the JSON appears under Configuration in use.

  5. Enter your Client ID, and your Client secret if the field is shown.

  6. Choose Response type, Prompt and Scope. The settings are explained in the next section.

  7. If your configuration has no jwks_uri, choose RS256 as Signing algorithm and paste your RSA public key.

  8. Select Save.

Note! We read the configuration once, when you save it. If your identity provider changes its endpoints later, select Remove configuration and add it again. This also clears the other settings on the page, so note your Client ID and secret first.

Signing keys from jwks_uri are different: we keep them for up to one hour, so a new key is picked up within the hour without any action from you.

Settings

These settings appear once a configuration is active.

Setting

What it does

Default

Client ID

Identifies your application at the identity provider.

Empty

Client secret

Sent to the token endpoint when we exchange a code for an ID token. Shown when signing keys come from jwks_uri.

Empty

Signing algorithm

How the ID token is signed. Only shown without jwks_uri, where RS256 is the only supported choice. With jwks_uri we accept RS256, RS384 and RS512.

Not chosen

RSA public key

The public key we verify the ID token with. Only shown without jwks_uri.

Empty

Response type

id_token: the identity provider sends the ID token directly. code: it sends a code, which we exchange for the ID token at your token endpoint, using PKCE.

id_token

Prompt

Whether the identity provider shows its login screen. login always asks the participant to log in. none never shows a screen. consent and select_account ask for consent or an account choice. You can also send no prompt parameter.

login

Scope

The scopes we request: openid, profile, email, address, phone. Choose the ones that release the claims you want to map.

openid

Remember the users id token for 31 days

Keeps the participant logged in for 31 days, even if the ID token expires sooner. Only shown with response type code.

Off

Only allow registrations through OpenID Connect

Rejects any registration from a participant who is not logged in.

Off

Authorize query parameters

Use this section to add extra parameters to the login request sent to your identity provider. Select Add new, then enter a Name and a Value. Use it for parameters your identity provider asks for, such as a language or a login policy.

Map data fields

Mapping connects a claim in the ID token, such as email, to a field on your registration page. You map one field at a time.

  1. Open the settings of a registration field, for example Email.

  2. Under Map OpenID Connect field, open Matching field from OpenID Connect and choose the claim.

  3. Save the field, and repeat for each field you want filled.

This is what happens for a participant who has logged in:

  • Mapped fields are hidden on the registration page.

  • When the participant registers, each mapped field gets its value from the ID token. Anything typed into that field is replaced.

  • If the token does not contain the claim, the field keeps the value from the form.

  • If the registration page has an email field and no other field needs input, the form is submitted automatically and the participant continues to the next page.

Keep these points in mind:

  • The list of claims comes from claims_supported in your configuration. A claim that is not listed there can't be mapped.

  • Only top-level claims can be mapped. A value inside a nested object, such as a street inside address, can't be picked out.

  • Your identity provider only releases a claim when the matching scope is requested. Add email or profile under Scope if those claims are missing.

  • Do not save input for later is switched on and locked for a mapped field, so the value is not stored in the participant's browser.

Add a login button

Participants start the login from a button in your campaign.

  1. Add a Button to the registration page.

  2. In the button's action, choose Login using OpenID Connect.

  3. Save the page.

The action only appears in the list once a configuration is active on the campaign.

After logging in, the participant returns to your campaign link, or to the demo link when you are testing. Query parameters from the address they started on are not carried over.

Hide content after login

Give an element the CSS class hide-when-logged-in to hide it for participants who are logged in. This is useful for the login button itself.

Note! The class only takes effect when Remember the users id token for 31 days is switched on.

How long participants stay logged in

A participant stays logged in for as long as the ID token is valid, unless you choose to remember them for longer.

Setup

Logged in for

Standard

Until 5 minutes before the ID token expires, and at least 1 minute.

ID token without an expiry time

1 hour.

Remember the users id token for 31 days switched on

31 days, also after the ID token has expired.

The login is stored in a cookie in the participant's browser. Logging out at your identity provider does not log the participant out of the campaign.

Test the integration

Test the login by going through the campaign yourself before you publish it.

  1. Make sure the redirect URI for the demo link's domain is allowed at your identity provider.

  2. Open the campaign's demo link and select your login button.

  3. Log in at your identity provider. You should land back on the campaign with the mapped fields hidden.

  4. Complete the registration and check that the registration holds the values from your identity provider.

  5. Repeat the test on the live campaign link once it is published.

Troubleshooting

What you see

Likely cause and fix

"Unable to fetch JSON from provided URL"

The URL did not answer within 10 seconds, did not return JSON, or the configuration lacks a required field. Check the table under Before you start.

"Unable to parse provided JSON as valid OpenID Connect configuration"

The pasted text is not valid JSON, or it lacks a required field.

"Unsupported signing algorithm chosen"

Without jwks_uri, only RS256 is supported. Choose RS256, or use a configuration with jwks_uri.

"Registration needs to be the first page"

You tried to move another page ahead of the registration page. It must stay first while the integration is set up.

Login using OpenID Connect is missing from the button's actions

No configuration is active on the campaign. Save a configuration first.

Your identity provider reports an invalid redirect URI

The redirect URI is not allowed for your application. The demo link and the live link use different domains, so add both.

The participant comes back to the campaign but is not logged in, and the address ends in #openid-error

We could not verify the ID token or exchange the code. Check Client ID, Client secret, the signing key and that the token has not expired.

A registration is rejected

Only allow registrations through OpenID Connect is on, and the participant is not logged in or their login has expired.

A mapped field is not filled

The ID token does not contain the claim. Check Scope and that the claim name matches.

Did this answer your question?