标签: firebase-authentication

用户名验证而不是电子邮件

使用Firebase,我可以使用电子邮件地址注册和登录用户.但是,如果我希望该应用程序是基于用户名的.例如,您将使用"Bobzilla"而不是"Bob@mail.com"登录?

Firebase可以实现吗?

firebase firebase-authentication

19
推荐指数
3
解决办法
1万
查看次数

Google使用Firebase登录Android - statusCode DEVELOPER_ERROR

我尝试在Firebase连接的Android应用中实施Google登录.当我运行应用程序并按Google登录按钮时 - 没有任何反应.我在onActivityResult中收到此错误: Status {statusCode = DEVELOPER_ERROR,resolution = null}.

我的代码看起来像这样:

     protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == REQUEST_CODE_GOOGLE_LOGIN) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);

        if (result.isSuccess()){
            GoogleSignInAccount account = result.getSignInAccount();
            String emailAddres = account.getEmail();
            getGoogleQAuthToken(emailAddres);
        }
    }
}

         private void getGoogleQAuthToken(final String emailAddres){
             AsyncTask<Void,Void,String> task = new AsyncTask<Void, Void, String>() {
                 String errorMessage = null;

                 @Override
                 protected String doInBackground(Void... params) {
                     String token = null;
                     try {
                         String scope = "oauth2:profile email";
                         token = GoogleAuthUtil.getToken(MainActivity.this, …
Run Code Online (Sandbox Code Playgroud)

android google-authentication firebase firebase-authentication firebaseui

19
推荐指数
4
解决办法
2万
查看次数

Android:如何使用FirebaseAuth从Facebook获取更大的个人资料照片?

我正在使用FirebaseAuth通过FB登录用户.这是代码:

private FirebaseAuth mAuth;
private FirebaseAuth.AuthStateListener mAuthListener;
private CallbackManager mCallbackManager;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FacebookSdk.sdkInitialize(getApplicationContext());

    // Initialize Firebase Auth
    mAuth = FirebaseAuth.getInstance();

    mAuthListener = firebaseAuth -> {
        FirebaseUser user = firebaseAuth.getCurrentUser();
        if (user != null) {
            // User is signed in
            Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
        } else {
            // User is signed out
            Log.d(TAG, "onAuthStateChanged:signed_out");
        }

        if (user != null) {
            Log.d(TAG, "User details : " + user.getDisplayName() + user.getEmail() + "\n" + user.getPhotoUrl() + …
Run Code Online (Sandbox Code Playgroud)

android facebook-authentication firebase firebase-authentication

19
推荐指数
3
解决办法
9961
查看次数

如何在firebase auth中更改电子邮件?

我正在尝试使用以下方法更改/更新用户的电子邮件地址:

firebase.auth().changeEmail({oldEmail, newEmail, password}, cb)
Run Code Online (Sandbox Code Playgroud)

但是我得到了...... changeEmail不是函数错误.我从旧的firebase文档中找到了这里的引用.

那么如何在3.x版本中实现呢?因为我无法在新文档中找到参考.

javascript firebase firebase-authentication

19
推荐指数
3
解决办法
2万
查看次数

我在哪里可以获得Firebase Admin的"serviceAccountCredentials.json"?

这里说的是我需要在java上设置Firebase:

FirebaseOptions options = new FirebaseOptions.Builder()
    .setDatabaseUrl("https://databaseName.firebaseio.com")
    .setServiceAccount(new FileInputStream("path/to/serviceAccountCredentials.json"))
    .build();
FirebaseApp.initializeApp(options);
Run Code Online (Sandbox Code Playgroud)

但是我在哪里可以获得serviceAccountCredentials.json

更新: 我发现这个文件似乎应该有这个字段,但是哪里得到这个值?

{
  "type": "",
  "project_id": "",
  "private_key_id": "",
  "private_key": "",
  "client_email": "",
  "client_id": "",
  "auth_uri": "",
  "token_uri": "",
  "auth_provider_x509_cert_url": "",
  "client_x509_cert_url": ""
}
Run Code Online (Sandbox Code Playgroud)

java firebase firebase-authentication firebase-realtime-database

19
推荐指数
2
解决办法
1万
查看次数

如何使用PHP(JWT)验证firebase ID令牌?

我有一个只有PHP(没有Java,没有node.js)的共享主机方案.我需要从我的Android应用程序发送firebase ID令牌并通过PHP-JWT验证它.

我正在按照教程:验证Firebase ID令牌

它说:

"如果您的后端使用的语言没有官方的Firebase Admin SDK,您仍然可以验证ID令牌.首先,找到适合您语言的第三方JWT库.然后,验证标题,有效负载和签名ID令牌."

我找到了这个库:Firebase-PHP-JWT.在gitHub示例中; 我无法理解

$关键部分:

`$key = "example_key";` 
Run Code Online (Sandbox Code Playgroud)

$ token部分:

`$token = array(
    "iss" => "http://example.org",
    "aud" => "http://example.com",
    "iat" => 1356999524,
    "nbf" => 1357000000
);`
Run Code Online (Sandbox Code Playgroud)

我的问题:

  1. 什么应该是$ key变量?
  2. 为什么&token变量是一个数组?将从移动应用程序发送的令牌是一个字符串.
  3. 如果有人可以发布一个用PHP-JWT验证firebase ID的完整示例,我将不胜感激.

编辑:

哦,我明白了.GitHub示例演示了如何生成JWT代码(编码)以及如何解码它.在我的情况下,我只需要解码由firebase编码的jwt.所以,我只需要使用这个代码:

$decoded = JWT::decode($jwt, $key, array('HS256'));
Run Code Online (Sandbox Code Playgroud)

在此代码部分中,$ jwt是firebase ID令牌.对于$ key变量文档说:

最后,确保ID令牌由与令牌的孩子声明相对应的私钥签名.从https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com获取公钥,并使用JWT库验证签名.使用来自该端点的响应的Cache-Control标头中的max-age值来了解何时刷新公钥.

我不明白如何将这个公钥传递给解码功能.键是这样的:

"----- BEGIN CERTIFICATE ----- \nMIIDHDCCAgSgAwIBAgIIZ36AHgMyvnQwDQYJKoZIhvcNAQEFBQAwMTEvMC0GA1UE \nAxMmc2VjdXJldG9rZW4uc3lzdGVtLmdzZXJ2aWNlYWNjb3VudC5jb20wHhcNMTcw \nMjA4MDA0NTI2WhcNMTcwMjExMDExNTI2WjAxMS8wLQYDVQQDEyZzZWN1cmV0b2tl \nbi5zeXN0ZW0uZ3NlcnZpY2VhY2NvdW50LmNvbTCCASIwDQYJKoZIhvcNAQEBBQAD \nggEPADCCAQoCggEBANBNTpiQplOYizNeLbs + r941T392wiuMWr1gSJEVykFyj7fe \nCCIhS/zrmG9jxVMK905KwceO/FNB4SK + l8GYLb559xZeJ6MFJ7QmRfL7Fjkq7GHS\N0/sOFpjX7vfKjxH5oT65Fb1 + …

php android jwt firebase firebase-authentication

19
推荐指数
3
解决办法
8274
查看次数

Firebase(电话身份验证)获取 iOS 错误:注册自定义 URL 方案

我的 Flutter 应用程序使用 Firebase Auth(电话)。我一直看到错误:'Please register custom URL scheme 'com.googleusercontent.apps.602546125958-5lk04ghhdfj5xxxxxxxx'

我已将 URL 架构添加到 info.plist 中,如下所示,但我遇到了同样的错误。

在此处输入图片说明

2020-04-29 20:40:05.173962-0400 Runner[395:20944] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Please register custom URL scheme 'com.googleusercontent.apps.602546125958-5lk04ghhdfj5xxxxxxxx' in the app's Info.plist file.'
*** First throw call stack:
(0x1889035f0 0x188625bcc 0x1887f9b28 0x10086cfa8 0x100f056a0 0x102efb3b0 0x102e921bc 0x102eeb9cc 0x102ea2a68 0x102ea4dcc 0x1888821c0 0x188881edc 0x1888815b8 0x18887c5c8 0x18887bc34 0x1929c538c 0x18c9ae22c 0x10082addc 0x188703800)
libc++abi.dylib: terminating with uncaught exception of type NSException
Run Code Online (Sandbox Code Playgroud)

ios firebase firebase-authentication flutter

19
推荐指数
5
解决办法
1万
查看次数

未定义的类“FirebaseUser”

我是 Flutter 的新手。我有Firebase Auth/Google Auth 的问题FirebaseUser未定义代码:

FirebaseAuth _auth = FirebaseAuth.instance;
GoogleSignIn googleSignIn = GoogleSignIn();

Future<FirebaseUser> currentUser() async { // The Issue is here in the Future<>
  final GoogleSignInAccount account = await googleSignIn.signIn();
  final GoogleSignInAuthentication authentication =
      await account.authentication;

  final GoogleAuthCredential credential = GoogleAuthProvider.getCredential(
      idToken: authentication.idToken, accessToken: authentication.accessToken);

  final AuthResult authResult = await _auth.signInWithCredential(credential);
  final FirebaseUser user = authResult.user; // and here as I can't define this FirebaseUser object to return

  return user;
}
Run Code Online (Sandbox Code Playgroud)

pubspec.yml

dependencies:
  flutter:
    sdk: …
Run Code Online (Sandbox Code Playgroud)

google-authentication dart firebase firebase-authentication flutter

19
推荐指数
2
解决办法
2万
查看次数

Firebase 电话验证 verifyPhoneNumber() 已弃用 + 应用程序崩溃

升级Firebase Auth (20.0.0)电话身份验证依赖项后出错,PhoneAuthProvider.getInstance().verifyPhoneNumber()

依赖:

implementation 'com.google.firebase:firebase-auth:20.0.0'
Run Code Online (Sandbox Code Playgroud)

错误:

java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/browser/customtabs/CustomTabsIntent$Builder;
        at com.google.firebase.auth.internal.RecaptchaActivity.zza(com.google.firebase:firebase-auth@@20.0.0:92)
        at com.google.firebase.auth.api.internal.zzeq.zza(com.google.firebase:firebase-auth@@20.0.0:79)
        at com.google.firebase.auth.api.internal.zzeq.onPostExecute(com.google.firebase:firebase-auth@@20.0.0:88)
        at android.os.AsyncTask.finish(AsyncTask.java:755)
        at android.os.AsyncTask.access$900(AsyncTask.java:192)
        at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:772)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:7948)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.browser.customtabs.CustomTabsIntent$Builder"
Run Code Online (Sandbox Code Playgroud)

谁能解释我应该为新的依赖项更改什么?有哪些新举措?

android deprecated firebase firebase-authentication

19
推荐指数
4
解决办法
1万
查看次数

Firebase 电话身份验证不适用于 Android 真机

我一直在尝试使用 Firebase 身份验证来实现电话身份验证。它正在与 android 模拟器一起使用。我在模拟器中使用了一个测试号和一个实数。两者都有效。但只有测试号码在真实设备上工作,并为其他号码抛出此异常

Error is:[firebase_auth/missing-client-identifier] This request is missing a valid app identifier, 
 meaning that neither SafetyNet checks nor reCAPTCHA checks succeeded. 
 Please try again, or check the logcat for more details.
Run Code Online (Sandbox Code Playgroud)

我也在 firebase 中设置了 SHA 密钥。

firebase firebase-authentication flutter

19
推荐指数
3
解决办法
2万
查看次数