Login with Microsoft Intune MAM
POST/oauth/intune
Authenticate a mobile user using a Microsoft Entra ID (Azure AD) access token for Intune Mobile Application Management (MAM) protected apps.
This endpoint enables authentication for mobile apps protected by Microsoft Intune MAM policies. The access token is obtained via the Microsoft Authentication Library (MSAL) and validated against the configured Azure AD tenant and Intune MAM app registration.
Authentication Flow:
- Mobile app acquires an Entra ID access token via MSAL with the Intune MAM scope
- Token is sent to this endpoint for validation
- Server validates the token signature, claims, and tenant configuration
- User is authenticated or created based on the token claims
- Session token is returned for subsequent API requests
User Provisioning:
- Office365 AuthService: Users are automatically created on first login using the
oid(Azure AD object ID) claim as the unique identifier - SAML AuthService: Users must first login via web/desktop to establish their account with the
oid(Azure AD object ID) as AuthData. Intune MAM always uses objectId for SAML users. For Entra ID Domain Services LDAP sync, configure LdapSettings.IdAttribute tomsDS-aadObjectIdto ensure consistency.
Error Handling: This endpoint returns specific HTTP status codes to help mobile apps handle different error scenarios:
428 Precondition Required: SAML user needs to login via web/desktop first403 Forbidden: Configuration issues or bot accounts409 Conflict: User account is deactivated401 Unauthorized: Token has expired400 Bad Request: Invalid token format, claims, or configuration
Permissions
No permission required. Authentication is performed via the Entra ID access token.
Enterprise Feature
Requires Mattermost Enterprise Advanced license and proper Intune MAM configuration (tenant ID, client ID, and auth service).
Request
Responses
- 200
- 400
- 401
- 403
- 409
- 428
- 500
- 501
User authentication successful
Bad request - Invalid token format, signature, claims, or configuration. Common causes include: invalid JSON body, missing access_token, malformed JWT, invalid token issuer/audience/tenant, missing required claims (oid, email), or empty auth data after extraction.
Unauthorized - The Entra ID access token has expired
Forbidden - Access denied. Common causes include: Intune MAM not properly configured or enabled, or user is a bot account (bots cannot use Intune login).
Conflict - User account has been deactivated (DeleteAt != 0)
Precondition Required - SAML user account not found. The user must first login via web or desktop application to establish their Mattermost account with objectId as AuthData before using mobile Intune MAM authentication. For Entra ID Domain Services LDAP sync, ensure SamlSettings.IdAttribute references the objectidentifier claim and LdapSettings.IdAttribute is set to 'msDS-aadObjectId'.
Internal Server Error - Server-side error. Common causes include: failed to initialize JWKS (JSON Web Key Set) from Microsoft's OpenID configuration, or failed to create user session.
Not Implemented - Intune MAM feature is not available. This occurs when running Mattermost Team Edition or when enterprise features are not loaded.