Features


Link Login

The user will receive a link (button) on their mail. When pressed, the user will be logged in.

Additional options

  • ReCaptcha: Preventing bots from accessing your site.
  • Validation Times: How many times a token should be clicked before it is validated (explained further bellow)
  • Link sent via email should redirect to Redirect URL
  • Email Domain Whitelist
  • "Mail Sent From" and "Reply To Mail"
  • Custom Email Template
  • Custom SMTP Provider
  • Logs

Explanation:

  1. Make sure your project has "LINK" selected under the "Login via" option
  2. Copy the integration script, and paste it in your project. You can style the elements however you like, as long as they keep their ids.
  3. When the user submits their mail, they will receive an verification link.
  4. When the link is accessed, if its accessed less than "Validation times", a page with the text "Clink the button bellow to validate your login request!" and a button will show up. When clicking the button the request is validated regardless of the validation times left. This feature is to prevent accidental link validation by spam protection, antivirus software, browser link preview etc... If the projects option "Link sent via email should redirect to Redirect URL" is checked, when the button/link is clicked the user will be redirects to "Redirect URL"
  5. Once the request is validated the script running on the submission page will hear an event that is broadcast on the web socket that its connected to and redirect the user to the redirect url if you have it set for your project, if not a JS custom event is triggered with the name "magicauth-success".
  6. When redirecting to the redirect url we append the following query params: 'type', 'project', 'request_id' and ' token'. Or if there is no redirect url the JS event you have the 'token', 'request_id' and 'project' in it.
  7. Using our API endpoint "/api/request_validated" with your api key as a header named "X-API_Key" and the request_id in the request body named "request_id" you can validate if the user has clicked the link or not. You should validate the login when the redirect url is accessed or the JS event is triggered. If the user has clicked the link you will get a response with a status of 200 and the users email, together with other info.
  8. At this point you should login the user or register them if you dont have the mail.



Code Login

The user will receive a code in their mail. When entered, the user will be logged in.

Additional options

  • ReCaptcha: Preventing bots from accessing your site.
  • Code sent via SMS
  • Email Domain Whitelist
  • "Mail Sent From" and "Reply To Mail"
  • Custom Email Template
  • Custom SMTP Provider
  • Logs

Explanation:

  1. Make sure your project has "CODE" selected under the "Login via" option
  2. Copy the integration script, and paste it in your project. You can style the elements however you like, as long as they keep their ids.
  3. The user can enter an email or phone number depending if the projects "Send code via SMS" option is checked. When the user submits their mail/phone, they will receive an verification code.
  4. When the code is entered, if its correct the script will redirect the user to the redirect url if you have it set for your project and a JS custom event is triggered with the name "magicauth-success".
  5. When redirecting to the redirect url we append the following query params: 'type', 'project', 'request_id'. Or if no request url is set, a JS event you have the 'token', 'request_id' and 'project' in it.
  6. Using our API endpoint "/api/request_validated" with your api key as a header named "X-API_Key" and the request_id in the request body named "request_id" you can validate if the user has used the corect code or not. You should validate the login when the redirect url is accessed or the JS event is triggered. If the user has used the correct code you will get a response with a status of 200 and the users email, together with other info.
  7. At this point you should login the user or register them if you dont have the mail.