How to use the @firebase/app.auth function in @firebase/app

To help you get started, we’ve selected a few @firebase/app examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deckgo / deckdeckgo / studio / src / app / pages / core / app-signin / app-signin.tsx View on Github external
await this.mergeService.mergeDeck(mergeInfo.deckId, mergeInfo.userToken, user.id);

                // Delete previous anonymous user from our backend
                await this.userService.delete(mergeInfo.userId, mergeInfo.userToken);

                // Delete previous anonymous user from Firebase
                if (this.firebaseUser) {
                    await this.firebaseUser.delete();
                }

                await this.navigateRedirect();

                resolve();
            });

            await firebase.auth().signInWithCredential(cred);

            resolve();
        });
    };
github pubpub / pubpub-editor / src / addons / Collaborative / collaborativePlugin.js View on Github external
loadDocument() {
		if (this.startedLoad) { return null; }
		this.startedLoad = true;

		/* Authenticate with Firebase if a firebaseToken is provided in the client data */
		const authenticationFunction = this.localClientData.firebaseToken
			? firebase.auth(this.firebaseApp).signInWithCustomToken(this.localClientData.firebaseToken)
			: new Promise((resolve)=> { return resolve(); });

		return authenticationFunction
		.then(()=> {
			/* Load the checkpoint if available */
			return this.firebaseRef.child('checkpoint').once('value');
		})
		.then((checkpointSnapshot) => {
			const checkpointSnapshotVal = checkpointSnapshot.val() || { k: '0', d: { type: 'doc', attrs: { meta: {} }, content: [{ type: 'paragraph' }] } };

			this.mostRecentRemoteKey = Number(checkpointSnapshotVal.k);
			const newDoc = Node.fromJSON(this.view.state.schema, uncompressStateJSON({ d: checkpointSnapshotVal.d }).doc);

			/* Get all changes since mostRecentRemoteKey */
			const getChanges = this.firebaseRef.child('changes')
			.orderByKey()
github deckgo / deckdeckgo / studio / src / app / pages / core / app-signin / app-signin.tsx View on Github external
'firebase-ui-css',
            'https://cdn.firebase.com/libs/firebaseui/4.0.0/firebaseui.css'
        );

        const appUrl: string = EnvironmentConfigService.getInstance().get('appUrl');

        const redirectUrl: string = await get('deckdeckgo_redirect');
        const mergeInfo: MergeInformation = await get('deckdeckgo_redirect_info');

        const signInOptions = [];

        signInOptions.push(firebase.auth.GoogleAuthProvider.PROVIDER_ID);
        signInOptions.push(firebase.auth.GithubAuthProvider.PROVIDER_ID);
        signInOptions.push(firebase.auth.EmailAuthProvider.PROVIDER_ID);

        this.firebaseUser = firebase.auth().currentUser;

        const uiConfig = {
            signInFlow: 'redirect',
            signInSuccessUrl: appUrl,
            signInOptions: signInOptions,
            // tosUrl and privacyPolicyUrl accept either url string or a callback
            // function.
            // Terms of service url/callback.
            tosUrl: appUrl + '/terms',
            // Privacy policy url/callback.
            privacyPolicyUrl: appUrl + '/privacy',
            credentialHelper: firebaseui.auth.CredentialHelper.GOOGLE_YOLO,
            autoUpgradeAnonymousUsers: true,
            callbacks: {
                signInSuccessWithAuthResult: (_authResult, _redirectUrl) => {
                    this.signInInProgress = true;
github deckgo / deckdeckgo / studio / src / app / pages / core / app-signin / app-signin.tsx View on Github external
// Ultimately I would like to transfer here the userService.updateMergedUser if async would be supported
                    this.navigateRoot(redirectUrl, mergeInfo);

                    return false;
                },
                // signInFailure callback must be provided to handle merge conflicts which
                // occur when an existing credential is linked to an anonymous user.
                signInFailure: this.onSignInFailure
            }
        };

        window['firebase'] = firebase;

        await this.saveRedirect();

        const ui = firebaseui.auth.AuthUI.getInstance() || new firebaseui.auth.AuthUI(firebase.auth());

        if (!ui.isPendingRedirect()) {
            ui.reset();
        }

        // The start method will wait until the DOM is loaded.
        ui.start('#firebaseui-auth-container', uiConfig);
    }
github gorgias / gorgias-chrome / src / store / plugin-firestore.js View on Github external
function signinWithToken (token = '') {
    return firebase.auth().signInWithCustomToken(token)
        .then((res) => {
            return updateCurrentUser(res.user);
        });
}
github engaging-computing / MYR / src / firebase.js View on Github external
let config = {
    apiKey: firebaseKey,
    authDomain: "myrjsecg.firebaseapp.com",
    databaseURL: "https://myrjsecg.firebaseio.com",
    projectId: "myrjsecg",
    storageBucket: "gs://myrjsecg.appspot.com",
    messagingSenderId: "967963389163"
};

firebase.initializeApp(config);
export default firebase;
export const provider = new firebase.auth.GoogleAuthProvider();
provider.setCustomParameters({
    prompt: "select_account"
});
export const auth = firebase.auth();
export const db = firebase.firestore();
export const scenes = db.collection("scenes");
export const snaps = db.collection("snaps");
export const classes = db.collection("classes");
export const storageRef = firebase.storage().ref();
github paularmstrong / react-stateful-firestore / src / Provider.js View on Github external
getChildContext() {
    const { app, select, selectAuth, selectStorage, store } = this.props.store;
    return {
      firebase: {
        app,
        auth: firebase.auth(app),
        firestore: firebase.firestore(app),
        messaging: firebase.messaging(app),
        select,
        selectAuth,
        selectStorage,
        storage: firebase.storage(app),
        store
      }
    };
  }
github gorgias / gorgias-chrome / src / store / plugin-firestore.js View on Github external
var signin = (params = {}) => {
    return firebase.auth().signInWithEmailAndPassword(params.email, params.password)
        .then((authRes) => {
            return updateCurrentUser(authRes.user);
        }).catch((err) => {
            return signinError(err);
        });
};
github SkyJedi / RPG-Web-Character-Creator / src / components / UserButton.js View on Github external
getName = () => {
		let user = firebase.auth().currentUser, name = 'Rando Calrissian';
		if (user) {
			if (user.email) name = user.email;
			else if (user.phoneNumber) name = user.phoneNumber;
		}
		return name;
	};