首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何使用firebase身份验证方法启用一键登录?

如何使用firebase身份验证方法启用一键登录?
EN

Stack Overflow用户
提问于 2020-08-17 14:32:34
回答 1查看 221关注 0票数 1

我正在尝试使用firebase auth实现一键登录,我已经从firebase auth中启用了google,并从google开发者控制台获取了客户端id,当我试图使用firebase auth和一键创建一个简单的一键登录时。我使用了firebase ui文档https://github.com/firebase/firebaseui-web#one-tap-sign-up代码,但在实施https://fir-auth-f72fb.firebaseapp.com/时,我仍然看不到任何一键登录,然后我获得了所有功能,但没有一键登录

EN

回答 1

Stack Overflow用户

发布于 2021-03-27 08:02:59

我使用了下面的代码

代码语言:javascript
运行
复制
import firebase from 'firebase/app';
import * as firebaseui from 'firebaseui'

const firebaseConfig = {
    apiKey: "",
    authDomain: "",
    databaseURL: "",
    projectId: "",
    storageBucket: "",
    messagingSenderId: "",
    appId: "",
    measurementId: ""
};

firebase.initializeApp(firebaseConfig);

let ui = new firebaseui.auth.AuthUI(firebase.auth());

let uiConfig = {
    signInOptions: [
        {
            provider: firebase.auth.GoogleAuthProvider.PROVIDER_ID,
            // Required to enable ID token credentials for this provider.
            // This can be obtained from the Credentials page of the Google APIs
            // console. Use the same OAuth client ID used for the Google provider
            // configured with GCIP or Firebase Auth.
            clientId: '',
            customParameters: {
                // Forces account selection even when one account
                // is available.
                prompt: 'select_account',
            },
        }
    ],
    // Enable one-tap sign-in.
    credentialHelper: firebaseui.auth.CredentialHelper.GOOGLE_YOLO
};

ui.start(".helper-firebase-ui", uiConfig);

使用类helper-firebase-ui在UI中创建一个div

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63445677

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档