Quickstart
Magical Auth is a 2FA verification service which allows you to verify a user using SIM-based verification.
The flow is meant to be done on a mobile device, but for the sake of this guide, we will create a simple web server and deploy it to allow you to send a request from a mobile web browser.
Prerequisites
Before you begin, you need to have the following:
- subscribe to the Magical Auth service, (guide here)
Step 1: Clone the Quickstart Project
To get started, clone the project repository from GitHub.
git clone https://github.com/GlideApis/magical-auth-starter-web-node.git
cd magical-auth-starter-web-node
This project contains a simple web server and frontend client to demonstrate the number verification process.
Step 2: Retrieve your credentials
From the Magical Auth service page (Which you can get to from here by clicking "Manage on Provider") there is a button "Copy .env file" under the "Credentials" section that will copy the credentials in the correct format to create an .env
file at the root of the project.
It should look like this:
GLIDE_CLIENT_ID=<YOUR_CLIENT_ID>
GLIDE_CLIENT_SECRET=<YOUR_CLIENT_SECRET>
Step 3: Deploy the Project
This project comes with a deployment script that will create a new Google Cloud Run service and build / deploy the server.
To build the project run the deploy
npm script:
npm run deploy
Follow the prompts as needed and this will build the project, creating a new Docker image in your GCP account and a new Cloud Run service using this image.
When complete you will see the URL of the deployed service.
More info
Opening the URL you will see a simple web page with a button to trigger the Magical Auth verification process.
If you open it from a Desktop browser for example, you can use the Glide Test Lab number +555123456789
to trigger the verification process. This number will always return a MAGIC
verification type and provide a test URL that can be opened on any device.
At the second stage you will see the different ways to trigger the verification process on a mobile device.
- Background - This will open an invisible iframe to trigger the verification process, due to limitations with 3rd party cookies this will be provided as an option if either the device supports it or the operator does not rely on 3rd party cookies.
- Popup - This will open a new window to trigger the verification process, the window will close automatically after the verification process is complete and it will communicate back to the parent window to update the status.
- Redirect - This will redirect the user to the verification URL, this is the most common method and will work on most devices.
No matter which method you choose, the verification process will be the same and you will get back a verification token which can be exchanged by the backend server to get the verification status.
Next Steps
Now that you have verified a phone number you can start integrating the Magical Auth into your application. For more information on the SDK you can refer to the SDK Reference.