-1

I'm getting a 401 Unauthorized error from Firebase when testing out my iOS app with the FirebaseAuth package using a cloud function. I am including the result of getIDTokenResult(forcingRefresh: true).token (which is returning a token that looks valid) in the "Authorization": "Bearer" header, which looks right when examining.

I have tried using Postman and it also doesn't work when using the token that getIDTokenResult(forcingRefresh: true).token provides, but it does work when I use gcloud auth print-identity-token to get my own token.

So it seems that getIDTokenResult(forcingRefresh: true).token is returning a token that looks valid but is not actually valid, or I have a misconfiguration of my Firebase project. Any ideas on how I could troubleshoot?

tharris
  • 2,192
  • 2
  • 13
  • 14

1 Answers1

0

The answer appears here:

Why can't I use `allAuthenticatedUsers` for my Firebase Cloud Function?

It appears that allAuthenticatedUsers means a Google authenticated user, so a user that is authenticated with "Sign in with Apple" would never be granted permission. The above link has example code for using allUsers but checking authorization status.

tharris
  • 2,192
  • 2
  • 13
  • 14