Firebase + React Native +使用Apple登录

问题描述

我正在尝试使用@invertase/react-native-apple-authentication软件包在Android上使用Apple登录https://github.com/invertase/react-native-apple-authentication/目前,我正在使用iOS,但是很难从Android的Firebase中恢复UID。我在控制台中看不到新添加用户,因为我认为我向Firebase发送了错误的信息?

我为此设置了与Android兼容的必要要求,包括在Apple开发者网站上为Web制作了serviceID,并在firebase控制台中启用了OAuth。并将所有ID和私钥分别放在相应的字段中。

  /**
   *
   * @returns {Promise<void>}
   */
  const handleAppleLogin = async () => {
    // Generate secure,random values for state and nonce
    const rawNonce = uuid();
    const state = uuid();

    try {
      appleAuthAndroid.configure({
        clientId: 'LEFT_OUT_MATCHES_THE_APPLE_CLIENT_ID',redirectUri: 'LEFT_OUT_MATCHES_THE_APPLE_REDIRECT',scope: appleAuthAndroid.Scope.ALL,responseType: appleAuthAndroid.ResponseType.ALL,nonce: rawNonce,state,});

      const { id_token } = await appleAuthAndroid.signIn();

      const androidCredential = firebase.auth.OAuthProvider.credential(
        id_token,rawNonce,);

      const userCredential = await firebase
        .auth()
        .signInWithCustomToken(androidCredential.token);

      // ALSO TRIED .signInWithCredential(androidCredential);

      console.log('userCredential',userCredential);

      ...

遵循文档:https://github.com/invertase/react-native-apple-authentication/blob/master/example/app.android.js

我可以获得id_token和appleAuthAndroid.signIn();附带的所有内容,并且可以获得androidCredential对象上所有内容的响应,包括providerId'secret ,and token {{ 1}} userCredential`我遇到了问题。

我没有从Firebase找回UID。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)