Jump to content
Unity Insider Forum

Probleme mit Firebase Authentifizierung mithilfe der Handy Nummer


Recommended Posts

Hallo,

ich versuche gerade mithilfe  des Firebase SDK eine Authentifizierung mit der eigenen Handy Nummer in eine Android zu integrieren. Bekomme das auch nach 3 Stunden noch immer net zum laufen. Vielleicht hab ihr ja ne Idee. 

Mein Code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Firebase;
using Firebase.Auth;

public class PhoneNumberAuth : MonoBehaviour {

    public InputField phoneNumText;
    public Text eText;

    public string phoneNum;

    private FirebaseAuth auth = FirebaseAuth.DefaultInstance;

    public PhoneNumberAuth(FirebaseAuth auth)
    {
        this.auth = auth;
    }

    // Use this for initialization
    void Start () {
        
    }
	
	// Update is called once per frame
	void Update () {
        phoneNum = phoneNumText.text.ToString();
    }

    public void SendPhoneNum()
    {
        Debug.Log(phoneNum);
        eText.text = "Wurde gesendet"+phoneNum;

        PhoneAuthProvider provider = PhoneAuthProvider.GetInstance(auth);
        provider.VerifyPhoneNumber(phoneNum, 60000, null,
            verificationCompleted: (credential) => {

            },
            verificationFailed: (error) => {
                eText.text = "Error:"+error;
            },
            codeSent: (id, token) => {
                
            },
            codeAutoRetrievalTimeOut: (id) => {

            });
    }
}

 

Bekomme auch ne Fehlermeldung:

ArgumentNullException: Argument cannot be null.
Parameter name: key
System.Collections.Generic.Dictionary`2[Firebase.Auth.FirebaseAuth,Firebase.Auth.PhoneAuthProvider].TryGetValue (Firebase.Auth.FirebaseAuth key, Firebase.Auth.PhoneAuthProvider& value) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:588)
Firebase.Auth.PhoneAuthProvider.GetInstance (Firebase.Auth.FirebaseAuth auth)
PhoneNumberAuth.SendPhoneNum () (at Assets/Scripts/PhoneNumberAuth.cs:37)
UnityEngine.Events.InvokableCall.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:166)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:58)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:36)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:45)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.EventSystem:Update()

Wäre cool wenn mir eine weiterhelfen könnte :)

Link to post
Share on other sites

Ooh, dein Fehler passiert auch in der Zeile davor, sehe ich gerade, bei GetInstance.

Mein Verdacht ist jetzt, dass auth null ist, also

FirebaseAuth.DefaultInstance

zu null evaluiert.

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...