Anvil App + Discourse Community

What I’m trying to do:
I’m trying to create a membership community management app in Anvil. I have chosen Discourse as the platform for the discussion forum but everything else (payments, emails, admin stuff etc.) will be done through Anvil.

I want to have a single user account associated with a member when they log into the Anvil app (for some admin stuff) and when they log into the Discourse community. I have done some Googling and it seems possible to set up SSO with Discourse and use Anvil’s user service as the identity provider.

I figure the Anvil employees know a thing or two about Discourse :wink:, how have you handled this if at all? Any tips?

1 Like

You’re on the right track! You can implement HTTP endpoints that follow discourse’s SSO protocol, and it will work :slight_smile:

(I don’t have sample code I can share; the SSO into this Discourse community is built into the user accounts for the Anvil editor itself, not the Users service, but the integration process was similar!)

One Anvil-specific tip: You’ll want to enable cross-origin sessions for the relevant HTTP endpoint(s), otherwise Anvil’s default XSRF protection will kick in and your endpoints will execute without knowledge of the logged-in user!

3 Likes

Thanks for the tip! That’s encouraging - will share what I’ve learned when it’s done :slight_smile:

1 Like