Hi. Brand new to Discourse. I have an app running on AWS, which uses Cognito for authentication. I want to link this app to my new Discourse hosted forum. I’ve got a good start, but I’m hoping somebody can provide guidance on the final steps to do this.
The goal is to make the login experience seamless between my app and discourse forum. So:
-
If a user is logged into my app, when they go to the Discourse forum Discourse recognizes this, and does not require a re-log in.
-
Similarly, if a user first goes to the Discourse forum and is not logged in, Discourse will redirect them to my app’s login page (or a hosted login ui if need be).
The OpenId Connect Authentication Plugin seems like its made well for this. I have signed up for a Business Plan with Discourse to be sure I can use this plugin.
I have gone through the instructions provided by @david and have done what I believe is the setup on the Cognito side:
-
From Cognito, I have gotten the “openid connect discovery document”, and “openidconnect client id”.
-
On my Discourse settings, under openId_Connect, I have added these in and saved them.
-
I have checked “enable openID connect authentication”, and under openid connect authorize scope, entered “openid email”. I have saved these settings.
According to the plugin description, this should be good to go, correct?
Well, when I log into my app, and then go to my forum, nothing happens. It just shows the normal home page with “signup” and “login” buttons present. I am hoping that it auto-logs me in after checking with Cognito, but it does not. What else do I need to do?
Additionally, if a user were coming to the forum site fresh (without every logging into my app), they should not see the Discourse signup and login buttons–rather, they should see a button that they would click that would redirect them to my app’s login. How do I add this?
And finally, users subscribe to my app and pay to use premium features. This is saved as custom attributes for the user in Cognito (there is a custom attribute that says Subscribed or not). Only Subscribed users should be able to post to the forum. So, when Discourse checks with Cognito to get the user’s information, it needs to check the user’s custom attribute, and only if the user is subscribed give them the ability to post. How do I do this?
Being so new to Discourse, I would greatly appreciate any information that anyone has about any of these questions. Thanks!