Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to use PasswordlessEmail flow doesn't work #12

Open
gabrielvillage opened this issue Jun 14, 2023 · 5 comments
Open

Trying to use PasswordlessEmail flow doesn't work #12

gabrielvillage opened this issue Jun 14, 2023 · 5 comments

Comments

@gabrielvillage
Copy link

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}");
@frederikprijck
Copy link

frederikprijck commented Jun 14, 2023

👋 I just tried the following using the underlying SDK, and it works fine for me:

var request = new PasswordlessEmailRequest
{
    ClientId = GetVariable("AUTH0_CLIENT_ID"),
    ClientSecret = GetVariable("AUTH0_CLIENT_SECRET"),
    Email = GetVariable("AUTH0_PASSWORDLESSDEMO_EMAIL"),
    Type = PasswordlessEmailRequestType.Link
};

var response = await authenticationApiClient.StartPasswordlessEmailFlowAsync(request);
response.Should().NotBeNull();
response.Email.Should().Be(request.Email);
response.Id.Should().NotBeNullOrEmpty();
response.EmailVerified.Should().NotBeNull();

So the underlying SDK seem to behave fine.
Can you call the endpoint using CURL, does it return the same response?

curl --request POST \
  --url 'https://{yourDomain}/passwordless/start' \
  --header 'content-type: application/json' \
  --data '{"client_id":"{yourClientId}", "client_secret":"{yourClientSecret}", "connection":"email", "email":"USER_EMAIL", "send":"link"}'

If it does, can you verify if your Auth0 tenant is configured correctly?

@gabrielvillage
Copy link
Author

Thanks for the response. The CURL call does work. What should be the correct Auth0 tenant setup?

@frederikprijck
Copy link

If the curl works, the tenant is set up correctly. I will look into something else and get back to you. Im wondering if the version of auth0.net, used in the unity SDK, might be related.

@frederikprijck
Copy link

I can't seem to reproduce this using Auth0.NET 7.15.0 neither, which should be the version used by the Unity SDK.

Any chance you can test it using straight up Auth0.NET yourself to help identify where the origin of the issue could be?

@nawangwe
Copy link

nawangwe commented Mar 8, 2024

Come on guys you have the opportunity to be the sole auth provider for Unity VR and you abandon this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants