Announcing the Magic Pages Open House. Quarterly calls with our team!

Skip to the answer

Connecting your Discourse forum

Create an API key in Discourse, paste two settings from your portal into your forum, test the connection and turn sign-in on. Step by step, with what to do when a check fails.

Jannis Fedoruk-Betschki Jannis Fedoruk-Betschki

Connecting your forum means pasting one thing from Discourse into your portal, and two things from your portal into Discourse. Then you test the connection, and turn sign-in on when every check passes.

Keep two tabs open: your Discourse admin, and the Discourse tab in your Customer portal. Click Connect your forum to start.

1. Create an API key in Discourse

In Discourse, go to Admin → Advanced → API keys and click Add API key.

  • Description: anything you'll recognise later, like "Magic Pages".
  • User level: All users.
  • Scope: Granular. Under users, tick sync_sso, show, suspend, anonymize, delete and log_out. Under groups, tick administer_groups.

Save it and copy the key. Discourse shows it only once.

The key can only do what forum sign-in needs, and we store it encrypted. It can't read your forum's settings, so the test checks what it can and lists the rest for you to check.

2. Fill in the form in your portal

Under Your Discourse forum:

  • Forum address: your forum's address, starting with https://, like https://community.example.com. Use the address the forum ends up on, with or without www.
  • Admin API key: the key you just copied. We store it encrypted and never show it again.
  • When a member is deleted in Ghost: what happens to a deleted member's forum account. Suspend their forum account is the default, and you can undo it. See what each choice does.
The Your Discourse forum card in the customer portal: Forum address is filled in with https://community.seasidenotes.example, the Admin API key field shows a masked key with the API key instructions below it, and When a member is deleted in Ghost is set to Suspend their forum account.

3. Paste two settings into Discourse

The Paste these into Discourse card holds two values. In your forum's admin, open Login & authentication → Discourse Connect, and paste them into these settings:

  • Discourse Connect URL: copy it from your portal. It's your site's address followed by /content/files/discourse/sso.
  • Discourse Connect secret: click Copy. We created this secret for your site, so only paste it into Discourse.
The Paste these into Discourse card: Discourse Connect URL https://www.seasidenotes.com/content/files/discourse/sso with a Copy button, Discourse Connect secret shown masked with Show and Copy buttons, and a Change these settings too note listing Enable Discourse Connect, Email editable, Max username length 30, Auth overrides name and Auth overrides email.

4. Change the other settings

The other settings are on three pages of your forum's admin. Change them in this order:

  • On the same page, turn on Enable Discourse Connect. This is the one that sends forum sign-ins to your site, so do it after the two settings above.
  • Under Users → Settings, turn off Email editable first. Discourse won't let you turn on Auth overrides email while it's on.
  • On the same page, set Max username length to 30. Discourse counts group names as usernames, and its default of 20 is too short for many tier names. There's more on group names here.
  • Under Login & authentication → Social logins, turn on Auth overrides name and Auth overrides email, so name and email changes in Ghost reach the forum.

From the moment Enable Discourse Connect is on, the forum's Log in button goes to your site. Members see "Forum sign-in is turned off for this site" until you finish step 6, so do steps 4 to 6 in one go.

If you ever lock yourself out of the forum, open yourforum.com/u/admin-login and Discourse emails you a sign-in link.

5. Test the connection

Back in your portal, click Test connection. It saves the form and goes through eight items, in order. The key can't read the last three settings, so the test lists them for you to check, with a button that opens each one:

Check What to do
The forum answered Check the forum address and that the forum is online. If it says the address redirects, use the address your browser ends up on.
Discourse accepted the API key Copy the key again in full. Check it hasn't been revoked and has the user level "All users". If the test names a missing scope, create a new key with every scope from step 1: Discourse can't add scopes to a key.
"Enable Discourse Connect" is on Turn it on.
"Discourse Connect URL" points to your site Paste the URL from your portal again. The test shows what it is now and what it should be.
"Discourse Connect secret" matches Copy the secret from your portal again.
"Auth overrides name" is on Check that it's on.
"Auth overrides email" is on Check that it's on. Turn off Email editable first, or Discourse won't let you.
"Max username length" fits every tier's group name Check that it's at least the number the test gives you. Discourse allows at most 60; if a tier needs more, email help@magicpages.co.

Fix what's listed in Discourse and click Test connection again. If the test says "Your forum is limiting requests", wait the seconds it gives you, then test again.

You can close the form after a failed test and come back to it later. Edit settings opens it again with every field, the forum address included.

Connection test passed: green ticks for The forum answered, Discourse accepted the API key, Enable Discourse Connect is on, Discourse Connect URL points to your site and Discourse Connect secret matches; three items to check by hand with buttons that open Auth overrides name, Email editable, Auth overrides email and Max username length on the forum; below, the Cancel, Test connection and Turn on forum sign-in buttons.

6. Turn on forum sign-in

When the test passes, click Turn on forum sign-in. We create a group in Discourse for each paid tier straight away.

Then try it yourself: open your forum in a private window, click Log in, and sign in with a member's email.

What you see afterwards

The Forum sign-in card shows how many members are on the forum, how many tier groups are synced, when the last sync ran, and what happens to deleted members. Edit settings opens the form again, and Open forum takes you to the forum.

The Forum sign-in card for community.seasidenotes.example with an On badge: Members on the forum 214, Tier groups 2 of 2 synced, Last sync 6 minutes ago, Deleted members Suspended; the Members can sign in to the forum switch is on, with Edit settings and Open forum buttons below.

Below it, the Tier groups card lists every tier and its forum group. Use the groups to keep categories for paying members.