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

Passwordless authentication does not accept additional parameters #807

Closed
6 tasks done
damianharden opened this issue Nov 28, 2023 · 2 comments
Closed
6 tasks done
Labels

Comments

@damianharden
Copy link

Checklist

Description

I am trying to pass additional parameters to Auth0 during passwordless authentication so that these parameters can be used to drive logic in a Post Login Action.

I have found that setting a parameter via parameters() fails for passwordless authentication (Auth0.authentication().startPasswordless()). However, if I instead call Auth0.webAuth() with a passwordless connection (like sms) and set parameters() for this approach then this does pass through additional parameters that are available in a Post Login Action via event.request.query.

I realise that these are separate calls (Auth0.authentication().startPasswordless() uses the /passwordless/start endpoint to call an API whilst Auth0.webAuth() opens a web view for the /authorize endpoint with the additional parameters appended to it).

Perhaps I am missing something. Can additional parameters be set for passwordless authentication (via Auth0.authentication().startPasswordless()) and if so how are these available in a Post Login Action?

If not:

  • what is the intent of the parameters() available to Auth0.authentication().startPasswordless()?
  • is passing additional parameters to Auth0 during passwordless authentication on the roadmap?

Reproduction

Call passwordless authentication with Auth0.authentication().startPasswordless():

Auth0
  .authentication()
  .startPasswordless(phoneNumber: mobileNumber, connection: "sms")
  .parameters(["message": "hello world"])
  .start { result in
    switch result {
      case .success:
        // Success
      case .failure(let error):
        // Failure
    }
  }

This call fails with the following error message:

Failed with: the following properties are not allowed: message

Next, call Auth0.webAuth() with a passwordless connection:

Auth0
  .webAuth()
  .connection("sms")
  .audience("https://api.example.com/")
  .scope("openid profile email")
  .useEphemeralSession()
  .parameters(["login_hint": mobileNumber])
  .parameters(["message": "hello world"])
  .start { result in
    switch result {
      case .success(let credentials):
        // Success
      case .failure(let error):
        // Failure
    }
  }

This call succeeds and the message parameter is visible in a Post Login Action via event.request.query.

Additional context

No response

Auth0.swift version

2.5.0

Platform

iOS

Platform version(s)

17.0

Xcode version

15.0.1

Package manager

Swift Package Manager

@damianharden damianharden added the bug This points to a verified bug in the code label Nov 28, 2023
@Widcket
Copy link
Contributor

Widcket commented Dec 11, 2023

Hi @damianharden,

For the parameters to be picked up by the PostLogin action, these should be sent when calling Auth0.webAuth() instead of startPasswordless(phoneNumber:connection:).

@Widcket Widcket added question and removed bug This points to a verified bug in the code labels Dec 11, 2023
@Widcket
Copy link
Contributor

Widcket commented Dec 11, 2023

Closing, as I believe the above answers your question. If you have any further questions, please reach out via Slack, as I see you're an Auth0 employee.

@Widcket Widcket closed this as completed Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants