title: react native android firebase sign in with apple [Error: The supplied auth credential is malformed, has expired or is not currently supported.]
body: <p>I am implementing sign in with Apple. I can successfully see the Apple login page. I key in the correct credentials. It should be able to sign in/sign up to the firebase based on the returned value from Apple.</p>
  <p>However I am getting this error <code>Error: The supplied auth credential is malformed, has expired or is not currently supported</code>. Something must be wrong at the firebase side? You may refer to the <code>onPressAppleLogin</code> function below on the logic. Many thanks!</p>
  <p><strong>What I have done:</strong></p>
  <p><strong>In Firebase</strong></p>
  <ol>
  <li>Authentication with Sign-in provider Apple <strong>enabled</strong></li>
  <li>My service id is <strong>co.myexampleapp.signinwithapple</strong></li>
  <li>My authorization callback is <strong><a href="https://my-example-app.firebaseapp.com/__/auth/handler" rel="noreferrer">https://my-example-app.firebaseapp.com/__/auth/handler</a></strong></li>
  </ol>
  <p><strong>In developer.apple.com</strong></p>
  <ol>
  <li>I created a service id <strong>co.myexampleapp.signinwithapple</strong> with the service <code>Sign In with Apple</code> <strong>enabled</strong></li>
  <li>I added <strong>my-example-app.firebaseapp.com</strong> for the Domain and <strong><a href="https://my-example-app.firebaseapp.com/__/auth/handler" rel="noreferrer">https://my-example-app.firebaseapp.com/__/auth/handler</a></strong> in the <code>Return URLs</code></li>
  </ol>
  <p><strong>My React Native source code</strong></p>
  <pre><code>import { appleAuthAndroid } from '@invertase/react-native-apple-authentication';
  import firebase from 'react-native-firebase'
  
  getRandomString = (length: any) =&gt; {
      let randomChars =
          'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
      let result = ''
      for (let i = 0; i &lt; length; i++) {
          result += randomChars.charAt(Math.floor(Math.random() * randomChars.length))
      }
      return result
  }
  
  onPressAppleLogin = async () =&gt; {
      const rawNonce = this.getRandomString(20);
      const state = this.getRandomString(20)
  
      appleAuthAndroid.configure({
          clientId: 'co.myexampleapp.signinwithapple',
          redirectUri: 'https://my-example-app.firebaseapp.com/__/auth/handler',
          responseType: appleAuthAndroid.ResponseType.ALL,
          scope: appleAuthAndroid.Scope.ALL,
          nonce: rawNonce,
          state,
      });
  
      const response = await appleAuthAndroid.signIn();
  
      const appleCredential = await firebase.auth.AppleAuthProvider.credential(response.id_token, rawNonce)
  
      const appleUserCredential = await firebase.auth().signInWithCredential(appleCredential) // error happens here!
  }
  </code></pre>