MicrosoftEntraProviderOptions class
Configuration for the Microsoft Entra ID OAuth provider.
Callback URL
https://example.com/auth/callback/microsoft-entra-id
Usage
import 'package:server_auth/server_auth.dart';
import 'package:server_auth/server_auth.dart';
final manager = AuthManager(
AuthOptions(
store: InMemoryAuthStore(),
storeMode: AuthStoreMode.ephemeral,
providers: [
microsoftEntraProvider(
MicrosoftEntraProviderOptions(
clientId: env('AZURE_AD_CLIENT_ID'),
clientSecret: env('AZURE_AD_CLIENT_SECRET'),
tenantId: env('AZURE_AD_TENANT_ID'), // or use tenantType
redirectUri: 'https://example.com/auth/callback/microsoft-entra-id',
),
),
],
),
);
Notes
- Uses OpenID Connect with OAuth 2.0.
- Set
tenantIdfor single-tenant apps, ortenantTypefor multi-tenant. - Microsoft returns profile picture as binary data - consider using Graph API.
Constructors
-
MicrosoftEntraProviderOptions({required String clientId, required String clientSecret, required String redirectUri, String? tenantId, MicrosoftEntraTenantType? tenantType, List<
String> scopes = const ['openid', 'profile', 'email']}) -
Creates a new MicrosoftEntraProviderOptions configuration.
const
Properties
- clientId → String
-
Application (client) ID from the Azure portal.
final
- clientSecret → String
-
Client secret from the Azure portal.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- redirectUri → String
-
The URI to redirect to after authentication.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
scopes
→ List<
String> -
OAuth scopes to request. Defaults to
['openid', 'profile', 'email'].final - tenantId → String?
-
Specific tenant ID (for single-tenant apps).
final
- tenantType → MicrosoftEntraTenantType?
-
Tenant type (for multi-tenant apps). Ignored if tenantId is set.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited