Problem statement
I want to perform passwordless authentication, but it doesn’t work.
The endpoint is “passwordless/start”
The code is as follows:
method: "POST", url: {myDomain}, {myDomain}, {myDomain}.
url: {myDomain} + "passwordless/start", headers: { "content-type
headers: { "content-type": "application/json" }, data: { "passwordless/start
data: {
client_id: client_id,
client_secret: client_secret,
send: "code", authParams: { authParams: { authParams
authParams: {
scope: "openid email"
}, }
}, }
I get the following error:
error_description: 'Invalid connection strategy. It must either be a passwordless connection'
Cause
This error is returned if you use the POST /passwordless/start endpoint without specifying a connection parameter of ‘email’ or ‘sms’.
Solution
The API call must have the following structure:
POST https://{yourDomain}/passwordless/start
Content-Type: application/json
{
"client_id": "{yourClientID}",
"client_secret": "{yourClientSecret}", // For Regular Web Applications
"connection": "email|sms",
"email": "{email}", //set for connection=email
"phone_number": "{phoneNumber}", //set for connection=sms
"send": "link|code", //if left null defaults to link
"authParams": { // any authentication parameters that you would like to add
"scope": "openid", // used when asking for a magic link
"state": "{yourState}" // used when asking for a magic link, or from the custom login page
}
}