Microsoft-Authentifizierung

:discourse: Hosted by us? This plugin is available on our Business and Enterprise plans. Amazon & Microsoft Logins | Discourse - Civilized Discussion

:discourse2: Summary Enable users to log in using their Microsoft accounts (aka Office 365 or Microsoft 365 accounts)
:open_book: Install Guide This plugin is bundled with Discourse core. There is no need to install the plugin separately.

Summary

Microsoft Authentication enables users to log in to your Discourse forum using their Microsoft accounts (also known as Office 365 or Microsoft 365 accounts). This simplifies the login process for organizations that use Microsoft services.

Features

  • Allows users to log in with their Microsoft credentials
  • Supports both multi-tenant and single-tenant configurations
  • Integrates with Microsoft Azure Active Directory
  • Simplifies user registration and login

Configuration

To set up Microsoft Authentication for your Discourse forum:

  1. Visit Azure Portal’s App Registration page

  2. Register a new application:

    • Choose a name (typically your site name)
    • Under “Supported account types,” select the most permissive option for your needs

  3. Add your site as a Redirect URI for Web in this format:

    • https://your.discourse.forum/auth/microsoft_office365/callback

  4. Save your changes

  5. Visit Certificates & secrets in the left sidebar menu and click New client secret

    • Add a simple description
    • Choose 24 months under “Expires” (note: you’ll need to renew it)
    • Copy the Value (this is the Application Secret) and save it for your plugin settings
  6. Visit Overview (in the left sidebar) and copy the Application (client ID)

  7. In your Discourse admin area, go to Settings and search for “microsoft auth”

  8. Enter the Application ID and Secret from the previous steps

Single-tenant authentication issues

If you’ve configured your Microsoft application as single_tenant, some users may experience issues when logging in. This happens because the emails used for login are considered untrusted, and the system cannot automatically link them to existing Discourse accounts.

To resolve this issue, users can:

  1. Look for the “Already have an account?” section at the bottom of the signup form
  2. Click the provided link to go through the account link-up process
  3. Complete the authentication steps to connect their Microsoft account to their existing Discourse account

Another option is to enable the microsoft auth email verified site setting, if admins are confident that all your users have verified emails.This ensures that returning users with existing accounts don’t create duplicate accounts when authenticating through Microsoft.

Additional configuration options

You can update all Microsoft Authentication settings by visiting the Admin > Settings area and searching for “microsoft auth”.

For single-tenant setups, you’ll need your tenant ID, which you can find in the Azure Portal tenant properties.

Additional resources

Last edited by @tobiaseigen 2025-07-16T21:37:09Z

Check documentPerform check on document:
25 „Gefällt mir“

Ich habe Probleme mit diesem Plugin.
Können Sie mir bitte Ratschläge geben?

Da ich (wieder einmal) beim Aktualisieren meiner Konfiguration für dieses Plugin auf Probleme gestoßen bin, habe ich diesen PR erstellt:

Das Problem ist, dass das Microsoft App-Panel drei vielversprechend aussehende Felder für das ‘Secret’ anbietet: Client ID, Value und ‘Secret ID’. Ohne Anleitung habe ich bei beiden Gelegenheiten, bei denen ich mich damit beschäftigt habe, das falsche gewählt, und ich vermute, dass ich nicht der Einzige bin!

Ich habe dieses Plugin gerade ausprobiert und es funktioniert nicht für Single Tenant.

Warum?

option :client_options,
             site: "https://login.microsoftonline.com",
             authorize_url: "/common/oauth2/v2.0/authorize",
             token_url: "/common/oauth2/v2.0/token"

Das Wort “common” ist das Problem.
Es scheint, dass dies durch die Tenant-ID für den Single Tenant ersetzt werden muss.
Wenn Sie ein MS-Konto haben, finden Sie Ihre Tenant-ID hier: Microsoft Azure

Ich habe noch nicht versucht, die Änderung selbst vorzunehmen. Vielleicht werde ich es tun.
Wenn nicht, müssen Sie nicht versuchen, es zu verwenden, wenn Sie es für Single Tenant verwenden möchten, es wird derzeit nicht funktionieren.

Siehe unten angehängtes Bild als Beispiel, welche Art von Fehler Sie erhalten.
image

Ok, ich habe noch nie mit Ruby programmiert, und es ist schon einige Jahre her, seit ich mit dem Programmieren und Arbeiten mit technischen Dingen zu tun hatte. Aber es ist erledigt. Und es funktioniert jetzt auch für Single-Tenant-Setups.

3 „Gefällt mir“

Entschuldigen Sie die sehr späte Rückmeldung hier, der obige PR wurde nun zusammengeführt!

2 „Gefällt mir“

Woohoo!

Mein erster Beitrag zur Community. Ich glaube nicht, dass es der letzte sein wird. :slight_smile:

2 „Gefällt mir“

:partying_face: Dieses Plugin ist jetzt Teil des Discourse-Kerns, wie in Bundling more popular plugins with Discourse core beschrieben. Wenn Sie selbst hosten und das Plugin verwenden, müssen Sie es vor Ihrem nächsten Upgrade aus Ihrer app.yml entfernen.