GithubHelp home page GithubHelp logo

anoxarc / nuxt-auth-app1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from palashmon/nuxt-auth-app1

0.0 0.0 0.0 30 KB

Implementing Authentication in a Nuxt.js App

JavaScript 18.60% CSS 0.48% Vue 80.92%

nuxt-auth-app1's Introduction

nuxt-auth-app1

Implementing Authentication in a Nuxt.js App using mevn-auth-api.

Spinning up a quick API

To save ourselves some time, we'll clone an API, which I have put together for this repo. For detailed explanation on how to setup the api, check out mevn-auth-api repo.

Once all setup is done, we can start the API:

# launch API server
$ npm run start

Run this Nuxt auth app

Once the API is up and running, we need to clone & install the dependencies for this app and then launch the app

# clone the app
git clone https://github.com/palashmon/nuxt-auth-app1.git
cd nuxt-auth-app1

# install dependencies
$ npm install

# serve with hot reload at localhost:3002
$ npm run dev

For detailed explanation on how things work, check out Nuxt.js docs.

Logic Implemented

  • Home page /, register page /register and login page /login are public, anyone can view it.
  • Only My profile page /profile is private, only logged in user can view it.
  • If not logged in and user tries to go to /profile, they will be redirected to /login page automatically.
  • If already logged in and user tries to go to /register or /login pages, they will be redirected to home / page automatically.
  • Implemented the logic to check for the inactivity of the user in our app. If the user is inactive for a period of time, then we automatically log out the user or show a timer first. We can update the timeout value for IDLE_TIMEOUT in .env file. Right now it set to 30 minutes. So, after 30 minutes a modal will open letting the user know that "Your session is about to expire in 60 seconds"
  • Added client-side form validation using Vuelidate plugin.

nuxt-auth-app1's People

Contributors

palashmon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.