Azure Login 

Extension key

ok_azure_login

Package name

oliverkroener/ok-azure-login

Version

3.0

Language

en

Author

Oliver Kroener <https://www.oliver-kroener.de> & Contributors

License

This document is published under the Open Publication License.

Rendered

Sat, 14 Feb 2026 22:58:26 +0000

Installation 

How to install this extension via Composer and add the content elements to your TYPO3 site.

Microsoft Entra ID Setup 

Register an application in Microsoft Entra ID and configure OAuth 2.0 credentials and permissions.

Configuration 

Configure Azure credentials per site using the backend module or via global extension settings as fallback.

Frequently Asked Questions (FAQ) 

Common questions about setup and usage.

How to get help 

Where to get help and how to report issues.

Installation 

Install with Composer 

Install the extension via Composer:

composer req oliverkroener/ok-azure-login
Copied!

After installation, update the database schema to create the configuration table:

vendor/bin/typo3 database:updateschema
Copied!

See also t3start:installing-extensions.

Include the static TypoScript 

  1. In the TYPO3 backend, go to the Template module
  2. Select the root page of your site
  3. Choose Info/Modify and click Edit the whole template record
  4. Switch to the Includes tab
  5. Add Azure Login from the list of available static templates

Add the content elements 

The extension provides two content elements, available under the Azure Login group in the New Content Element Wizard:

Azure Login
Renders a "Sign in with Microsoft" button. When a user authenticates via Microsoft Entra ID, the extension matches their email to an existing fe_users record and logs them in.
Azure Logout
Renders a "Sign out" button for logged-in users. Can optionally redirect to the Microsoft logout endpoint to sign the user out of Microsoft as well.

To add them:

  1. Go to the Page module and select the page where the login or logout button should appear
  2. Click Create new content element
  3. Select from the Azure Login group: either Azure Login or Azure Logout
  4. Configure the element settings (button theme, redirect URL, etc.)
  5. Save and clear caches

Backend login 

The extension automatically registers a backend login provider. Once configured (see Configuration), one or more "Sign in with Microsoft" buttons appear as a separate tab on the TYPO3 backend login screen at /typo3/.

To set up backend login:

  1. Go to Web > Azure Login and switch to the Backend tab
  2. Click Add Backend Login Configuration
  3. Fill in the Azure credentials (Tenant ID, Client ID, Client Secret, Label)
  4. Copy the auto-generated Redirect URI and register it in your Azure app
  5. Save the configuration

The backend redirect URI (/typo3/azure-login/callback) is automatically derived from the TYPO3 route configuration. You can create multiple backend login configurations for different Azure tenants.

Configuration of Microsoft Entra ID (formerly Azure AD) 

This guide walks you through registering an application in Microsoft Entra ID so the extension can authenticate users via the OAuth 2.0 authorization code flow.

  1. Register an application in Microsoft Entra ID

    Go to https://portal.azure.com and navigate to Microsoft Entra ID > App registrations.

  2. Configure the application

    • Name: Choose a descriptive name (e.g. "TYPO3 Azure Login").
    • Supported account types: Select "Accounts in this organizational directory only (Single tenant)".
  3. Add redirect URIs

    Under Redirect URI, select Web and add the callback URLs that match your TYPO3 site:

    • Frontend: https://your-domain.com/your-login-page (the page containing the Azure Login content element)
    • Backend: https://your-domain.com/typo3/azure-login/callback

    Click Register.

  4. Collect Tenant ID and Client ID

    On the Overview page, note down:

    • Directory (tenant) ID -- this is the Tenant ID
    • Application (client) ID -- this is the Client ID
  5. Create a client secret

    • Navigate to Certificates & secrets > Client secrets
    • Click New client secret
    • Enter a description and choose an expiration period
    • Click Add
  6. Configure API permissions

    The extension uses the authorization code flow with delegated permissions (not application permissions). It requests the following scopes:

    • openid -- sign-in
    • profile -- basic user profile
    • User.Read -- read the signed-in user's profile (email, display name)

    To configure:

    • Navigate to API permissions
    • Click Add a permission > Microsoft Graph > Delegated permissions
    • Select: openid, profile, User.Read
    • Click Add permissions
    • Click Grant admin consent for [Your Organization]
  7. Configure in TYPO3

    Enter the collected credentials (Tenant ID, Client ID, Client Secret, redirect URIs) in the TYPO3 backend module at Web > Azure Login.

    See Configuration for details.

Configuration 

After completing the Microsoft Entra ID setup, configure the extension in TYPO3 with the credentials obtained from Azure.

Extension settings (fallback) 

As a fallback, global credentials can be configured via Extension Configuration in the TYPO3 backend (Admin Tools > Settings > Extension Configuration > ok_azure_login).

These global settings are used when no per-site database configuration exists for the current site. This is useful for simple single-site installations or as a migration path from older versions of the extension.

The following settings are available:

tenantId

tenantId
type

string

Default

(empty)

The Directory (tenant) ID from your Microsoft Entra ID app registration.

clientId

clientId
type

string

Default

(empty)

The Application (client) ID from your Microsoft Entra ID app registration.

clientSecret

clientSecret
type

string

Default

(empty)

The Client Secret Value from your Microsoft Entra ID app registration.

redirectUriFrontend

redirectUriFrontend
type

string

Default

(empty)

The OAuth callback URL for frontend login.

Example: https://your-domain.com/azure-login/callback

redirectUriBackend

redirectUriBackend
type

string

Default

(empty)

The OAuth callback URL for backend login (legacy setting).

Configuration resolution order 

The extension resolves Azure credentials differently for frontend and backend:

Frontend login:

  1. Database configuration for the current site root page (from the backend module)
  2. Extension Configuration (global fallback)

Backend login:

  1. Configuration by UID (if a specific config was selected)
  2. Database configuration for the current site root page
  3. Global backend configuration (site_root_page_id = 0)
  4. Extension Configuration (global fallback)

If a database record exists but has an empty Tenant ID, it is treated as unconfigured and the extension falls back to the next source.

TypoScript configuration 

The extension registers a static TypoScript template Azure Login that configures the Fluid template paths. Include it via the Template module (see Installation).

You can override the template paths via TypoScript constants:

plugin.tx_okazurelogin_login {
    view {
        templateRootPath = EXT:your_sitepackage/Resources/Private/Extensions/OkAzureLogin/Templates/
        partialRootPath = EXT:your_sitepackage/Resources/Private/Extensions/OkAzureLogin/Partials/
        layoutRootPath = EXT:your_sitepackage/Resources/Private/Extensions/OkAzureLogin/Layouts/
    }
}
Copied!

Content element settings 

Azure Login (frontend login)
Button Theme
Choose between a dark or light Microsoft button style.
Azure Logout (frontend logout)
Button Theme
Choose between a dark or light Microsoft button style.
Microsoft Sign-Out
When enabled, the user is redirected to the Microsoft logout endpoint to sign them out of Microsoft as well as TYPO3.
Redirect URL
Custom URL to redirect to after logout. Defaults to the site root.

How it works 

The authentication flow is handled entirely by the extension:

  1. The content element renders a "Sign in with Microsoft" button linking to the Microsoft Entra ID authorization endpoint.
  2. The user authenticates at Microsoft and is redirected back with an authorization code.
  3. A PSR-15 middleware intercepts the callback, exchanges the code for user information via the Microsoft Graph API, and injects the user data into the TYPO3 authentication chain.
  4. The TYPO3 authentication service looks up the user by email in the appropriate user table (fe_users or be_users).
  5. If a matching, non-disabled user is found, they are logged in and redirected to the return URL.
  6. For frontend login: if no matching user is found and auto-create is enabled, a disabled fe_users record is created. The user sees a message that their account is pending activation.
  7. For backend login: if no matching user is found, the user is redirected back to the login page with an error message.

Security notes 

  • Encrypted secrets: Client secrets stored via the backend module are encrypted at rest using PHP Sodium (sodium_crypto_secretbox). The encryption key is derived from TYPO3's encryptionKey.
  • HMAC-signed state: The OAuth state parameter is HMAC-signed using TYPO3's encryptionKey and has a 10-minute TTL to prevent CSRF and replay attacks.
  • Per-site isolation: Each TYPO3 site can have its own Azure credentials, preventing credential leakage across multi-site installations.
  • SameSite cookie handling: The middleware preserves session cookies on the OAuth callback redirect and downgrades SameSite=Strict to SameSite=Lax to ensure the browser sends cookies after the cross-site redirect from Microsoft.
  • Stale parameter stripping: The middleware removes stale azure_login_error and azure_login_success query parameters from the return URL before appending the current result, preventing parameter accumulation on retries.
  • Never commit client secrets to version control.
  • Use separate Azure app registrations for development, staging, and production.
  • Rotate client secrets regularly before their expiration date.

Frequently Asked Questions (FAQ) 

See chapter Installation.

Backend users: Yes. A matching be_users record with the same email address must exist in TYPO3.

Frontend users: By default, yes. However, if auto-create is enabled in the site configuration, the extension will automatically create a disabled fe_users record on first login. An administrator must then enable the account before the user can sign in.

See Frontend user auto-creation for details.

Yes. For frontend login, add the Azure Login content element to a page. For backend login, the extension automatically adds a "Sign in with Microsoft" tab to the TYPO3 backend login screen. Both require a redirect URI configured in Microsoft Entra ID.

The backend redirect URI is automatically derived from the TYPO3 route configuration and shown as a read-only field in the backend module.

Yes. The Backend tab in the configuration module allows you to create multiple backend login configurations. Each one appears as a separate "Sign in with Microsoft" button on the backend login screen, with its own label (e.g. company name). This is useful when multiple Azure tenants need backend access.

The extension requires delegated permissions only: openid, profile, and User.Read. No application permissions are needed. See the Azure Entra ID setup for details.

The recommended method is the backend module at Web > Azure Login. This allows per-site configuration with encrypted client secret storage and supports multiple backend login configurations.

As a fallback, global credentials can be set via Admin Tools > Settings > Extension Configuration > ok_azure_login.

See chapter Configuration.

Yes. The backend module stores configuration per TYPO3 site root page. Click on any page belonging to a site in the page tree, and the module resolves the correct site automatically. Each site can have its own Tenant ID, Client ID, Client Secret, and frontend redirect URI.

When configured via the backend module, the client secret is encrypted using PHP Sodium (sodium_crypto_secretbox) before being stored in the database. The encryption key is derived from TYPO3's $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'].

The secret is never displayed in the backend module after saving.

The auto-created fe_users record is disabled by default. The user will see a message explaining that their account has been created but is pending activation. An administrator must enable the account in the TYPO3 backend before the user can sign in.

Auto-created users are assigned to the default user groups configured in the site settings and stored on the configured storage page.

See chapter Where to get help.

Sitemap