From 31854bae5b8e1b45afccce549259a481c111cf83 Mon Sep 17 00:00:00 2001 From: Chris Bianca Date: Mon, 16 Oct 2017 11:12:40 +0100 Subject: [PATCH] [auth] Update auth providers `providerId` to match official SDKs --- .../java/io/invertase/firebase/auth/RNFirebaseAuth.java | 8 ++++---- docs/modules/authentication.md | 4 ++-- ios/RNFirebase/auth/RNFirebaseAuth.m | 8 ++++---- lib/modules/auth/providers/FacebookAuthProvider.js | 2 +- lib/modules/auth/providers/GithubAuthProvider.js | 2 +- lib/modules/auth/providers/GoogleAuthProvider.js | 2 +- lib/modules/auth/providers/TwitterAuthProvider.js | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java index a6c3d31c..d4bc7a1f 100644 --- a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java +++ b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java @@ -1059,13 +1059,13 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule { */ private AuthCredential getCredentialForProvider(String provider, String authToken, String authSecret) { switch (provider) { - case "facebook": + case "facebook.com": return FacebookAuthProvider.getCredential(authToken); - case "google": + case "google.com": return GoogleAuthProvider.getCredential(authToken, authSecret); - case "twitter": + case "twitter.com": return TwitterAuthProvider.getCredential(authToken, authSecret); - case "github": + case "github.com": return GithubAuthProvider.getCredential(authToken); case "phone": return PhoneAuthProvider.getCredential(authToken, authSecret); diff --git a/docs/modules/authentication.md b/docs/modules/authentication.md index ac6c0a73..8a070be7 100644 --- a/docs/modules/authentication.md +++ b/docs/modules/authentication.md @@ -100,7 +100,7 @@ Sign in the user with a 3rd party credential provider. `credential` requires the ```javascript const credential = { - provider: 'facebook', + provider: 'facebook.com', token: '12345', secret: '6789', }; @@ -210,7 +210,7 @@ Reauthenticate the current user with credentials: ```javascript const credentials = { - provider: 'facebook', + provider: 'facebook.com', token: '12345', secret: '6789', }; diff --git a/ios/RNFirebase/auth/RNFirebaseAuth.m b/ios/RNFirebase/auth/RNFirebaseAuth.m index ba6cd293..56f5ecee 100644 --- a/ios/RNFirebase/auth/RNFirebaseAuth.m +++ b/ios/RNFirebase/auth/RNFirebaseAuth.m @@ -889,15 +889,15 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail: - (FIRAuthCredential *)getCredentialForProvider:(NSString *)provider token:(NSString *)authToken secret:(NSString *)authTokenSecret { FIRAuthCredential *credential; - if ([provider compare:@"twitter" options:NSCaseInsensitiveSearch] == NSOrderedSame) { + if ([provider compare:@"twitter.com" options:NSCaseInsensitiveSearch] == NSOrderedSame) { credential = [FIRTwitterAuthProvider credentialWithToken:authToken secret:authTokenSecret]; - } else if ([provider compare:@"facebook" options:NSCaseInsensitiveSearch] == NSOrderedSame) { + } else if ([provider compare:@"facebook.com" options:NSCaseInsensitiveSearch] == NSOrderedSame) { credential = [FIRFacebookAuthProvider credentialWithAccessToken:authToken]; - } else if ([provider compare:@"google" options:NSCaseInsensitiveSearch] == NSOrderedSame) { + } else if ([provider compare:@"google.com" options:NSCaseInsensitiveSearch] == NSOrderedSame) { credential = [FIRGoogleAuthProvider credentialWithIDToken:authToken accessToken:authTokenSecret]; } else if ([provider compare:@"password" options:NSCaseInsensitiveSearch] == NSOrderedSame) { credential = [FIREmailAuthProvider credentialWithEmail:authToken password:authTokenSecret]; - } else if ([provider compare:@"github" options:NSCaseInsensitiveSearch] == NSOrderedSame) { + } else if ([provider compare:@"github.com" options:NSCaseInsensitiveSearch] == NSOrderedSame) { credential = [FIRGitHubAuthProvider credentialWithToken:authToken]; } else if ([provider compare:@"phone" options:NSCaseInsensitiveSearch] == NSOrderedSame) { credential = [[FIRPhoneAuthProvider provider] credentialWithVerificationID:authToken verificationCode:authTokenSecret]; diff --git a/lib/modules/auth/providers/FacebookAuthProvider.js b/lib/modules/auth/providers/FacebookAuthProvider.js index d30c190f..c8abbc10 100644 --- a/lib/modules/auth/providers/FacebookAuthProvider.js +++ b/lib/modules/auth/providers/FacebookAuthProvider.js @@ -1,4 +1,4 @@ -const providerId = 'facebook'; +const providerId = 'facebook.com'; export default class FacebookAuthProvider { constructor() { diff --git a/lib/modules/auth/providers/GithubAuthProvider.js b/lib/modules/auth/providers/GithubAuthProvider.js index afbfa37b..fbd84272 100644 --- a/lib/modules/auth/providers/GithubAuthProvider.js +++ b/lib/modules/auth/providers/GithubAuthProvider.js @@ -1,4 +1,4 @@ -const providerId = 'github'; +const providerId = 'github.com'; export default class GithubAuthProvider { constructor() { diff --git a/lib/modules/auth/providers/GoogleAuthProvider.js b/lib/modules/auth/providers/GoogleAuthProvider.js index 4a9bac49..eda9f241 100644 --- a/lib/modules/auth/providers/GoogleAuthProvider.js +++ b/lib/modules/auth/providers/GoogleAuthProvider.js @@ -1,4 +1,4 @@ -const providerId = 'google'; +const providerId = 'google.com'; export default class GoogleAuthProvider { constructor() { diff --git a/lib/modules/auth/providers/TwitterAuthProvider.js b/lib/modules/auth/providers/TwitterAuthProvider.js index feddf6ab..15c0a2f6 100644 --- a/lib/modules/auth/providers/TwitterAuthProvider.js +++ b/lib/modules/auth/providers/TwitterAuthProvider.js @@ -1,4 +1,4 @@ -const providerId = 'twitter'; +const providerId = 'twitter.com'; export default class TwitterAuthProvider { constructor() {