NuxtJS – Authentication made easy with Magic

These days adding authentication to an application is very challenging, and you shouldn’t build it from scratch. As the centralized companies on the internet have already failed us in protecting user’s privacy and data.

The user trust model of the int…


This content originally appeared on DEV Community and was authored by Mohammad Shahbaz Alam

These days adding authentication to an application is very challenging, and you shouldn’t build it from scratch. As the centralized companies on the internet have already failed us in protecting user's privacy and data.

The user trust model of the internet is broken. Let's fix it one step at a time.

Introduction

Hi ?, in this guide you'll be learning how to add passwordless login to a Nuxt.js application using Magic Link.

Nuxt.js is a higher-level framework based on Vue.js to create production-ready modern web applications. Nuxt is inspired by Next.js, which is a framework of similar purpose, based on React.js.

Create a secured Nuxt.js application with Magic

Let’s start by creating our application using npx make-magic

npx make-magic --template nuxt

After a few seconds, you will be prompted for a project name, this will also be the name of the folder that will be created for this project.

Enter your project name

After putting in a project name, you will be prompted for your Magic Publishable API Key, which enables user authentication with Magic.

Enter Magic Publishable Key

To get your publishable API key, you'll need to sign up to Magic Dashboard. Once you've signed up, an app will be created upon your first login (you'll be able to create new apps later).

Magic Dashboard

You'll now be able to see your Test Publishable API Key - copy and paste the key into your CLI prompt.

Entered Magic Test Publishable API key

After hitting Enter, you'll be asked to select whether you’d like to use npm / yarn as the NPM client for your project.

Select NPM Client

After selecting your NPM client, the nuxt server will automatically start, and your application will be running on http://localhost:3000.

In this example app, you'll be prompted to sign up for a new account using an email address or login into an existing one. The authentication process is secured by Magic.

Login page of the Nuxt.js application

After clicking on your magic link email, you'll be successfully logged in, and redirected to the profile page that displays your email, issuer, and public address.

Profile page of the Nuxt.js application displaying user's info

Read the full guide on https://magic.link/posts/magic-nuxt

Live Demo: https://magic-nuxtjs.vercel.app/


This content originally appeared on DEV Community and was authored by Mohammad Shahbaz Alam


Print Share Comment Cite Upload Translate Updates
APA

Mohammad Shahbaz Alam | Sciencx (2021-05-17T19:40:04+00:00) NuxtJS – Authentication made easy with Magic. Retrieved from https://www.scien.cx/2021/05/17/nuxtjs-authentication-made-easy-with-magic/

MLA
" » NuxtJS – Authentication made easy with Magic." Mohammad Shahbaz Alam | Sciencx - Monday May 17, 2021, https://www.scien.cx/2021/05/17/nuxtjs-authentication-made-easy-with-magic/
HARVARD
Mohammad Shahbaz Alam | Sciencx Monday May 17, 2021 » NuxtJS – Authentication made easy with Magic., viewed ,<https://www.scien.cx/2021/05/17/nuxtjs-authentication-made-easy-with-magic/>
VANCOUVER
Mohammad Shahbaz Alam | Sciencx - » NuxtJS – Authentication made easy with Magic. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/05/17/nuxtjs-authentication-made-easy-with-magic/
CHICAGO
" » NuxtJS – Authentication made easy with Magic." Mohammad Shahbaz Alam | Sciencx - Accessed . https://www.scien.cx/2021/05/17/nuxtjs-authentication-made-easy-with-magic/
IEEE
" » NuxtJS – Authentication made easy with Magic." Mohammad Shahbaz Alam | Sciencx [Online]. Available: https://www.scien.cx/2021/05/17/nuxtjs-authentication-made-easy-with-magic/. [Accessed: ]
rf:citation
» NuxtJS – Authentication made easy with Magic | Mohammad Shahbaz Alam | Sciencx | https://www.scien.cx/2021/05/17/nuxtjs-authentication-made-easy-with-magic/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.