auth0-unity icon indicating copy to clipboard operation
auth0-unity copied to clipboard

Trying to use PasswordlessEmail flow doesn't work

Open gabrielvillage opened this issue 1 year ago • 5 comments

Hello! I'm trying to implement Auth0 on my Unity project and when calling the StartPasswordlessEmailFlowAsync I get the following error: Error Unity Auth0.Core.Exceptions.ApiError : {"error":"bad.connection","error_description":"Missing required property: connection"} I don't know how to fix it as the PasswordlessEmailRequest doesn't have a Connection parameter and digging into the StartPasswordlessEmailFlowAsync method it shows it sets the connection type to "email".

Here's the code I'm using:

        var request = new PasswordlessEmailRequest()
        {
            ClientId = clientId,
            ClientSecret = authManager.Settings.ClientSecret,
            Email = emailField.text,
            Type = PasswordlessEmailRequestType.Link,
        };

        PasswordlessEmailResponse response = null;
        ErrorApiException apiError = null;

        try
        {

            response = await authManager.Auth0.StartPasswordlessEmailFlowAsync(request);
        }
        catch (ErrorApiException ex)
        {
            apiError = ex;
        }

        if (apiError != null)
        {
            Debug.LogError(apiError.ApiError + " : " + apiError.Message);
            return;
        }
        Debug.Log($"{response.Email} : {response.EmailVerified} : {response.Id}");

gabrielvillage avatar Jun 14 '23 09:06 gabrielvillage