Microsoft Authentication

: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개의 좋아요

해당 플러그인을 사용하는데 문제가 있습니다.
조언을 주실 수 있을까요?

이 플러그인의 설정을 업데이트할 때 또다시 헤맸기 때문에 이 PR을 만들었습니다:

문제는 Microsoft 앱 패널에서 'Secret’으로 사용할 수 있는 것으로 보이는 세 가지 필드(Client ID, Value, ‘Secret ID’)를 제공하고 있다는 점입니다. 가이드라인이 없어서 이 문제를 다룰 때마다 두 번 모두 잘못된 필드를 선택했고, 저만이 그런 것이 아닐 것이라 생각합니다!

이 플러그인을 사용해 보았는데, 단일 테넌트에서는 작동하지 않습니다.

왜일까요?

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

문제는 "common"이라는 단어입니다.
단일 테넌트에서는 이 부분을 테넌트 ID로 대체해야 하는 것 같습니다.
MS 계정이 있다면 여기서 테넌트 ID를 찾을 수 있습니다: Microsoft Azure

아직 직접 변경해 보지 않았습니다. 어쩌면 시도해 볼지도 모릅니다.
만약 제가 하지 않는다면, 단일 테넌트로 이 플러그인을 사용하려는 다른 분들에게 말씀드리자면, 굳이 시도하지 않으셔도 됩니다. 현재 상태로는 작동하지 않습니다.

아래 첨부된 이미지를 참고하여 어떤 종류의 오류가 발생하는지 확인해 보세요.
image

음, 저는 Ruby로 코딩해 본 적이 없고, 기술적인 작업을 한 것도 몇 년 전이었습니다. 하지만 이제 완료되었습니다. 싱글 테넌트 환경에서도 정상적으로 작동합니다.

3개의 좋아요

여기까지 이렇게나 늦게 후속 답변을 드려 죄송합니다. 위 PR이 이제 병합되었습니다!

2개의 좋아요

와아!

커뮤니티에 첫 기여입니다. 마지막은 아닐 것 같아요. :slight_smile:

2개의 좋아요

:partying_face: 이 플러그인은 이제 Bundling more popular plugins with Discourse core 의 일부로 Discourse 코어에 번들링되었습니다. 자체 호스팅(self-hosting) 환경에서 이 플러그인을 사용 중이라면, 다음 업그레이드 전에 app.yml에서 해당 플러그인을 제거해야 합니다.