[js] implemented remaining auth providers on auth() : auth(). EmailAuthProvider, GithubAuthProvider, FacebookAuthProvider, TwitterAuthProvider and GoogleAuthProvider
This commit is contained in:
parent
9d520c4693
commit
52713426d1
|
@ -415,7 +415,7 @@ public class RNFirebaseAuth extends ReactContextBaseJavaModule {
|
|||
case "facebook":
|
||||
return FacebookAuthProvider.getCredential(authToken);
|
||||
case "google":
|
||||
return GoogleAuthProvider.getCredential(authToken, null);
|
||||
return GoogleAuthProvider.getCredential(authToken, authSecret);
|
||||
case "twitter":
|
||||
return TwitterAuthProvider.getCredential(authToken, authSecret);
|
||||
case "github":
|
||||
|
|
|
@ -3,12 +3,17 @@ import { NativeModules, NativeEventEmitter } from 'react-native';
|
|||
|
||||
import User from './user';
|
||||
import { Base } from './../base';
|
||||
|
||||
// providers
|
||||
import EmailAuthProvider from './providers/Email';
|
||||
import GoogleAuthProvider from './providers/Google';
|
||||
import FacebookAuthProvider from './providers/Facebook';
|
||||
import TwitterAuthProvider from './providers/Twitter';
|
||||
import GithubAuthProvider from './providers/Github';
|
||||
|
||||
const FirebaseAuth = NativeModules.RNFirebaseAuth;
|
||||
const FirebaseAuthEvt = new NativeEventEmitter(FirebaseAuth);
|
||||
|
||||
// TODO move user methods to user class
|
||||
export default class Auth extends Base {
|
||||
_user: User|null;
|
||||
_authResult: AuthResultType | null;
|
||||
|
@ -21,11 +26,13 @@ export default class Auth extends Base {
|
|||
this.authenticated = false;
|
||||
|
||||
// attach auth providers
|
||||
// TODO add missing providers
|
||||
this.EmailAuthProvider = EmailAuthProvider;
|
||||
// start listening straight away
|
||||
// generally though the initial event fired will get ignored
|
||||
// but this is ok as we fake it with the getCurrentUser below
|
||||
this.GoogleAuthProvider = GoogleAuthProvider;
|
||||
this.FacebookAuthProvider = FacebookAuthProvider;
|
||||
this.TwitterAuthProvider = TwitterAuthProvider;
|
||||
this.GithubAuthProvider = GithubAuthProvider;
|
||||
|
||||
// start listening immediately for auth changes
|
||||
FirebaseAuthEvt.addListener('onAuthStateChanged', this._onAuthStateChanged.bind(this));
|
||||
FirebaseAuth.addAuthStateListener();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
export default {
|
||||
credential(token) {
|
||||
return {
|
||||
token,
|
||||
secret: '',
|
||||
provider: 'facebook',
|
||||
};
|
||||
},
|
||||
};
|
|
@ -0,0 +1,9 @@
|
|||
export default {
|
||||
credential(token) {
|
||||
return {
|
||||
token,
|
||||
secret: '',
|
||||
provider: 'github',
|
||||
};
|
||||
},
|
||||
};
|
|
@ -0,0 +1,9 @@
|
|||
export default {
|
||||
credential(token, secret) {
|
||||
return {
|
||||
token,
|
||||
secret,
|
||||
provider: 'google',
|
||||
};
|
||||
},
|
||||
};
|
|
@ -0,0 +1,9 @@
|
|||
export default {
|
||||
credential(token, secret) {
|
||||
return {
|
||||
token,
|
||||
secret,
|
||||
provider: 'twitter',
|
||||
};
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue