forked from firebase/flutterfire
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[firebase_auth] AuthCredential for email and link (firebase#1458)
* Add `getCredentialWithLink`
- Loading branch information
1 parent
6af4818
commit 5d5116c
Showing
7 changed files
with
109 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ description: Flutter plugin for Firebase Auth, enabling Android and iOS | |
like Google, Facebook and Twitter. | ||
author: Flutter Team <[email protected]> | ||
homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_auth | ||
version: "0.8.4" | ||
version: "0.8.4+1" | ||
|
||
flutter: | ||
plugin: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -213,6 +213,82 @@ void main() { | |
); | ||
}); | ||
|
||
test('EmailAuthProvider (withLink) linkWithCredential', () async { | ||
final AuthCredential credential = EmailAuthProvider.getCredentialWithLink( | ||
email: '[email protected]', | ||
link: '<Url with domain from your Firebase project>', | ||
); | ||
final FirebaseUser user = await auth.linkWithCredential(credential); | ||
verifyUser(user); | ||
expect( | ||
log, | ||
<Matcher>[ | ||
isMethodCall( | ||
'linkWithCredential', | ||
arguments: <String, dynamic>{ | ||
'app': auth.app.name, | ||
'provider': 'password', | ||
'data': <String, String>{ | ||
'email': '[email protected]', | ||
'link': '<Url with domain from your Firebase project>', | ||
}, | ||
}, | ||
), | ||
], | ||
); | ||
}); | ||
|
||
test('EmailAuthProvider (withLink) signInWithCredential', () async { | ||
final AuthCredential credential = EmailAuthProvider.getCredentialWithLink( | ||
email: '[email protected]', | ||
link: '<Url with domain from your Firebase project>', | ||
); | ||
final FirebaseUser user = await auth.signInWithCredential(credential); | ||
verifyUser(user); | ||
expect( | ||
log, | ||
<Matcher>[ | ||
isMethodCall( | ||
'signInWithCredential', | ||
arguments: <String, dynamic>{ | ||
'app': auth.app.name, | ||
'provider': 'password', | ||
'data': <String, String>{ | ||
'email': '[email protected]', | ||
'link': '<Url with domain from your Firebase project>', | ||
}, | ||
}, | ||
), | ||
], | ||
); | ||
}); | ||
|
||
test('EmailAuthProvider (withLink) reauthenticateWithCredential', () async { | ||
final FirebaseUser user = await auth.currentUser(); | ||
log.clear(); | ||
final AuthCredential credential = EmailAuthProvider.getCredentialWithLink( | ||
email: '[email protected]', | ||
link: '<Url with domain from your Firebase project>', | ||
); | ||
await user.reauthenticateWithCredential(credential); | ||
expect( | ||
log, | ||
<Matcher>[ | ||
isMethodCall( | ||
'reauthenticateWithCredential', | ||
arguments: <String, dynamic>{ | ||
'app': auth.app.name, | ||
'provider': 'password', | ||
'data': <String, String>{ | ||
'email': '[email protected]', | ||
'link': '<Url with domain from your Firebase project>', | ||
} | ||
}, | ||
), | ||
], | ||
); | ||
}); | ||
|
||
test('TwitterAuthProvider linkWithCredential', () async { | ||
final AuthCredential credential = TwitterAuthProvider.getCredential( | ||
authToken: kMockIdToken, | ||
|