Firebase App Verify Throws 401 Error on iOS Units


I’m encountering a 401 error with Firebase App Verify on iOS gadgets and need assistance figuring out the difficulty.
We’re utilizing Firebase App Verify to safe our backend API. The setup on Android was profitable, and every part works as anticipated. Nevertheless, we face difficulties with the iOS setup. When utilizing debug tokens on iOS, App Verify works high quality, however switching to manufacturing leads to a 401 error.

What We Have Tried:

  • We have now configured App Attest in Xcode, setting the setting to “manufacturing,”.

  • As a substitute, we additionally tried utilizing DeviceCheck, however we encountered the identical difficulty.

Doable Points:

  • There is likely to be a misconfiguration on the Apple Developer account aspect, corresponding to lacking capabilities or an issue with the provisioning profile.

  • It is also potential that there’s a mistake in our Xcode undertaking configuration or an error in our Firebase App Verify integration code.

May somebody information us on what we is likely to be doing flawed? Are there particular settings or configurations on the Apple Developer aspect or in Xcode that we have to confirm?
Or might the difficulty be with our code setup for integrating Firebase App Verify on iOS? Any recommendation or pointers can be drastically appreciated!

Unity 2022.3.34f1
Firebase 12.0.0
Xcode 15.4
Firebase Cloud Operate

verifications: {
  app: "MISSING"
  auth: "VALID"
}
// Logs
2:Firebase.Features.FunctionsException: Unauthenticated
  at Firebase.Features.HttpsCallableReference.b__9_0 (System.Threading.Duties.Activity`1[TResult] job) [0x00000] in <00000000000000000000000000000000>:0
  at System.Threading.Duties.ContinuationResultTaskFromResultTask`2[TAntecedentResult,TResult].InnerInvoke () [0x00000] in <00000000000000000000000000000000>:0
  at System.Threading.Duties.Activity.Execute () [0x00000] in <00000000000000000000000000000000>:0
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
  at System.Threading.Duties.Activity.ExecuteWithThreadLocal (System.Threading.Duties.Activity& currentTaskSlot) [0x00000] in <00000000000000000000000000000000>:0
  at System.Threading.Duties.Activity.ExecuteEntry (System.Boolean bPreventDoubleExecution) [0x00000] in <00000000000000000000000000000000>:0
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <00000000000000000000000000000000>:0
--- Finish of stack hint from earlier location the place exception was thrown ---

  at TestScript.CheckHash () [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00000] in <00000000000000000000000000000000>:0
  at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0

d__4:MoveNext()
UnityEngine.UnitySynchronizationContext:Exec()
utilizing System;
utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing _Car_Parking.Scripts.Database;
utilizing Cysharp.Threading.Duties;
utilizing Firebase.AppCheck;
utilizing Firebase.Features;
utilizing UnityEngine;

public class TestScript : MonoBehaviour
{
    // Begin known as earlier than the primary body replace
    void Begin()
    {
        FirebaseInitializer firebaseInitializer = new FirebaseInitializer();
        firebaseInitializer.Initialize();
    }

    public void Verify()
    {
        CheckHash().Overlook();
    }

    public void GenerateApp()
    {
        GenerateAppAttest().Overlook();
    }
    non-public async UniTaskVoid GenerateAppAttest()
    {
        FirebaseAppCheck.SetAppCheckProviderFactory(AppAttestProviderFactory.Occasion);
        Debug.Log("Generrate AppattestToken");
    }
    non-public async UniTaskVoid CheckHash()
    {
        attempt
        {
            Debug.Log("result1 begin");
            var r  = FirebaseFunctions.DefaultInstance.GetHttpsCallable("PrintHash");
            await r.CallAsync("");
            Debug.Log("result1:" + r);
        }
        catch (Exception e)
        {
            Debug.LogError("1:" + e);
        }

        attempt
        {
            Debug.Log("result2 begin");
            var r  = FirebaseFunctions.DefaultInstance.GetHttpsCallable("PrintHash2");
            await r.CallAsync("");
            Debug.Log("result2:" + r);
        }
        catch (Exception e)
        {
            Debug.LogError("2:" + e);
        }
    }
    
}

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles