@@ -24,22 +24,22 @@ const _kProviderId = 'microsoft.com';
24
24
/// .then(...);
25
25
/// ```
26
26
///
27
- /// If authenticating with Microsoft via a 3rd party, use the returned
28
- /// `accessToken` to sign-in or link the user with the created credential, for
29
- /// example:
30
- ///
27
+ /// For native apps, you may also sign-in with [signInWithProvider] . Ensure you have
28
+ /// an app configured in the Microsoft Azure portal.
29
+ /// See Firebase documentation for more information: https://firebase.google.com/docs/auth/flutter/federated-auth?#microsoft
31
30
/// ```dart
32
- /// String accessToken = '...'; // From 3rd party provider
33
- /// var microsoftAuthCredential = MicrosoftAuthProvider.credential(accessToken);
34
- ///
35
- /// FirebaseAuth.instance.signInWithCredential(microsoftAuthCredential)
36
- /// .then(...);
31
+ /// MicrosoftAuthProvider microsoftProvider = MicrosoftAuthProvider();
32
+ /// microsoftProvider.setCustomParameters({'tenant': 'TENANT ID FROM AZURE PORTAL'},);
33
+ /// await FirebaseAuth.instance.signInWithProvider(microsoftProvider);
37
34
/// ```
38
35
class MicrosoftAuthProvider extends AuthProvider {
39
36
/// Creates a new instance.
40
37
MicrosoftAuthProvider () : super (_kProviderId);
41
38
42
39
/// Create a new [MicrosoftAuthCredential] from a provided [accessToken] ;
40
+ @Deprecated (
41
+ '`credential()` has been deprecated. Sign-in cannot be directly achieved with OAuth access token based credentials for Microsoft. Please use `signInWithProvider(MicrosoftAuthProvider)` instead.' ,
42
+ )
43
43
static OAuthCredential credential (String accessToken) {
44
44
return MicrosoftAuthCredential ._credential (
45
45
accessToken,
@@ -85,16 +85,15 @@ class MicrosoftAuthProvider extends AuthProvider {
85
85
}
86
86
}
87
87
88
- /// The auth credential returned from calling
89
- /// [MicrosoftAuthProvider.credential] .
88
+ // ignore: deprecated_member_use_from_same_package
89
+ /// [MicrosoftAuthProvider.credential] returns a [MicrosoftAuthCredential] instance .
90
90
class MicrosoftAuthCredential extends OAuthCredential {
91
91
MicrosoftAuthCredential ._({
92
92
required String accessToken,
93
93
}) : super (
94
94
providerId: _kProviderId,
95
95
signInMethod: _kProviderId,
96
96
accessToken: accessToken);
97
-
98
97
factory MicrosoftAuthCredential ._credential (String accessToken) {
99
98
return MicrosoftAuthCredential ._(accessToken: accessToken);
100
99
}
0 commit comments