Discourse Connect on Local instance is not working

AI-generated summary

Discourse Connect Issue on Local Instance

Vairav_Lakshmanan is experiencing an issue with Discourse Connect on a local instance. After setting up Discourse Connect for single sign-on (SSO) authentication, clicking the login button results in a NoMethodError. The error occurs due to the FakeDiscourseConnectController not being allowed in a production environment.

hawm suggests that the issue is due to the insecure nature of the authentication plugin, which requires setting the DISCOURSE_DEV_ALLOW_ANON_TO_IMPERSONATE environment variable to 1 for it to work.

david provides a temporary solution by disabling the FakeDiscourseConnectController by creating a dev.yml file in the config directory with the line auth_plugin_enabled: false. This fix allows the redirection to the SSO URL to occur.

Vairav_Lakshmanan confirms that the solution works, and the redirection is now happening successfully.

When I tried to set up discourse in my local machine following the below article: Install Discourse on macOS for development.

Set up is fine and the discourse is running locally. But when I enable discourse-connect to use discourse connect authentication following the below article: Setup DiscourseConnect - Official Single-Sign-On for Discourse (sso)

After this setup, if I tried to click on login button, am getting the error as follows :slight_smile:

# NoMethodError in DevelopmentAuth::FakeDiscourseConnectController#auth

undefined method `is_allowed?’ for #DevelopmentAuth::FakeDiscourseConnectController:0x00007f9e1e8ec3a8

Please help me to resolve this issue and make discourse connect work in local instance. I have also attached the error screenshot FYR.

TIA

You may take a look:

Thanks for the report @Vairav_Lakshmanan, we’ll get this fixed up.

In the meantime, you can disable this FakeDiscourseConnectController by creating a file in the config directory: config/dev.yml

Inside, you need one line:

auth_plugin_enabled: false

Then, when you restart the server, the fake DiscourseConnect provider will be disabled.

We are actually trying to test SSO. So our requirement is the discourse which is running locally has to redirect to the SSO URL mentioned in the settings. The above-said redirection is not happening in the local environment.

PS: We already enabled the “enable_discourse_connect” field and provided the “discourse_url” and also the “secret”. When we click on login we are getting the above mentioned error.

Thanks for the quick reply. By making the above mentioned change, now the redirection is happening. Thanks a lot