微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

react-native-apple-authentication返回appleAuthAndroid的空对象

如何解决react-native-apple-authentication返回appleAuthAndroid的空对象

我正在尝试在@invertase/react-native-apple-authentication": "2.1.0"上使用react-native@0.61.5在Android上实现Apple auth。 appleAuth在iOS上运行良好,但appleAuthAndroid只是返回一个空对象。

import { appleAuth,appleAuthAndroid } from '@invertase/react-native-apple-authentication';

export const loginWithAppleAndroid = () => async () => {
  // performs login request
  try {
    console.log('appleAuth',appleAuth)  //logs full appleAuth object as expected
    console.log('appleAuthAndroid',appleAuthAndroid)    //logs an empty object 

    const rawNonce = uuidv4();
    const state = uuidv4();

  // Configure the request
    appleAuthAndroid.configure({
    
    // The Service ID you registered with Apple
    clientId: ' myID',// Return URL added to your Apple dev console. We intercept this redirect,but it must still match
    // the URL you provided to Apple. It can be an empty route on your backend as it's never called.
    redirectUri: 'https://myURI.com',// The type of response requested - code,id_token,or both.
    responseType: appleAuthAndroid.ResponseType.ALL,// The amount of user information requested from Apple.
    scope: appleAuthAndroid.Scope.ALL,// Random nonce value that will be SHA256 hashed before sending to Apple.
    nonce: rawNonce,// Unique state value used to prevent CSRF attacks. A UUID will be generated if nothing is provided.
    state,});

  // Open the browser window for user sign in
  const response = await appleAuthAndroid.signIn();

  // Send the authorization code to your backend for verification
    return response
  } catch (error) {
      console.warn(appleAuth.State);
        throw error;
      
  }
};

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。