Use to send magic link to end user to authenticate without a password
Request
POST <https://api.ezid.io/email-link/send>
Content-type: application/json
{
"email":"[email protected]", //mandatory, email of end user
"client_id":"8b5e6e7a45caec7b891c13a8a2484acf", //mandatory, this is your app's id that is provided
"client_secret":"4d6765d698ce1824a678ca07143decdba4c123d08743e72eb8b0bf7fc4028d8e", //mandatory, app's secret that is provided - note: this should always be stored only in a secure server and never in the front end
"base_url_email_link":"<https://planettree.co/auth>", // mandatory; the base url of the email link sent is this; Default "<http://localhost:3000>"
"expiry":"3600000", // optional, in milliseconds; default "300000"
"push_email":"No", //optional if you don't want to send email; default "Yes"
"callback_url":"<https://planettree.co/home>", // optional; the url to redirect to once authenticated. If not provided this would be defaulted to the base_url_email_link value
"login_hint":"[email protected]", //optional; can add this to include user email to be able to prepopulate email once user clicks on magic link
"claims":{ // can add custom claims for API access control. This is returned encoded within the access token, even when the access token is refreshed with the refresh token.
"role": "read-only-user",
}
}
Response
{
status: 200
}
{
"success": true,
"email_link": "<https://planettree.co?code=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1dWlkIjoiMmRmYmVlMmEtZDFhYS00MjYwLWE3YzctNjU2Y2MxMWZjMTg0IiwiaWF0IjoxNjM5OTczNzkxLCJleHAiOjE2Mzk5NzczOTF9.NMWJ-4jpq8PS2hR6VbVCk-JQgY-dytbBA4cFKS2hA58&callback_url=https%3A%2F%2Fplanettree.co%2Fhome&[email protected]>"
}
Next: Verify email link