Adds a login button on Discourse which allows logging in using a Silverstripe site’s user account.

To Setup

  1. On Silverstripe site:

    1. Install https://github.com/IanSimpson/ss-oauth2-server on Silverstripe site.

      1. If Guzzle version issue, add to config.json:
        1. "guzzlehttp/psr7": "2.1.0 as 1.4"
      2. Setup as per docs and add config:
      IanSimpson\\OAuth2\\OauthServerController:
        privateKey: 'private.key'
        publicKey: 'public.key'
        encryptionKey: 'INSERTKEYHERE'
      

      c. dev/build

      d. In Site Config, create a Client

      Redirect URI: http://DISCOURSE_HOST/auth/oauth2_basic/callback

  2. On Discourse:

    1. Install https://github.com/discourse/discourse-oauth2-basic
    2. Add Settings > Login:
      1. oauth2 enabled: yes
      2. oauth2 client id: From Silverstripe Client
      3. oauth2 client secret: From Silverstripe Client
      4. oauth2 authorize url: https://yourwebsite.com/oauth/authorize
      5. oauth2 token url: https://yourwebsite.com/oauth/access_token
      6. oauth2 button title: (scroll down): My Site Name

    Now Set Up JSON Endpoint to pass user details to Discourse

    Docs: https://github.com/discourse/discourse-oauth2-basic#part-2-configuring-the-json-user-endpoint

    Still TODO. Ideally create a Silverstripe module for this.

    Basics:


    Restrictions/Notes