🪄 Magic Login
🪄

Magic login links for your website or app

Sign in for a free trial. No credit card required.

Implementation instructions

  1. Make sure you are logged in magic.mk and have created a project. Set a redirect URL, this is the url that the user will be redirected to after they press the link they get on their email. On this link you will get the token you need to validate as a url query parameter (together with some other query params).
  2. View and copy the embed code, its an email submit form, and some JS that is needed for the login to work
  3. Style the field and button however you like, you can target them by their ids:
    #magic-input and #magic-submit
  4. On the redirect url you need to expect the query parameter "token", you can validate this token with your projects api key, on our endpoint: "/api/validate/". Place your api key in the headers, naming it "X-API-Key" , in the requests body put the token you received with the name "token". If the response code is 200, you can find information about the logged in user in the json response. Remember to properly handle responses that are not 200!
  5. Here is an example script in php for token validation