JWT Authentication with Elixir & Phoenix

2h 54m 2s
English
Paid

Course description

Implement JWT based authentication in Elixir. The language which powers, in one way or another (ErLang) Whatsapp, Discord, Pinterest etc. We will be using Phoenix Framework, the fantastic MVC framework for developing backends and full stack projects in Elixir. Consider Phoenix more like Express of Node.js but way more cooler of course. Well, Elixir altogether is cooler than any other language I code but nevertheless, one thing at a time.

Read more about the course

Architecture

  1. Users

    1. Register User

      1. Accept user details like "email", "password", "username" etc. and persist it in the db (PostgreSQL).

    2. Password Hashing

      1. Store irreversible one way hashed password in the db rather than storing the plain tet password, which would be a disaster if you ask me.

    3. Login

      1. Login based on "username" and "password". Validate password w.r.t password hash stored in the db and if everything matches up issue a JWT token for further interaction with the API (protected routes).

    4. Get Authenticated User

      1. Get back the authenticated user w.r.t to token passwed in the authorization header. But avoiding spitting back the password and fetching it altogether from the db, even though it is hashed it still does not make any sense.

    5. Logout

      1. Invalidating a JWT token by storing it against the "user_id" in the db. So that after log out with a particular token, that token can not be used again for accessing private routes. We did this since JWT tokens can not be destroyed they can only be expired when there time comes. So what happens when someone logs out before their token expires? Oxygen for thought.

  2. Protected Routes

    1. Implement private routes to maintain an access control list => what can be accessed and what not. For example, a non authenticated user (guest) should not have access to the following apis

      1. Logout

      2. Ping (an example of ping pong Get request to demonstrate private route mechanism).

      3. etc...

  3. Postman

    1. Test the REST API with Postman along the way, while developing each route/api.

  4. A lot more

    1. We will be learning a lot more than written, about Elixir, Phoenix, PostgreSQL, and creating REST APIs altogether.

Watch Online

Join premium to watch
Go to premium
# Title Duration
1 Intro 06:08
2 Project Setup 17:50
3 Password hashing and Registration 28:39
4 Login and Issuing a JWT token 36:04
5 Phoenix plugs and protected routes 40:25
6 Logging out and invalidating a JWT token 44:56

Comments

0 comments

Want to join the conversation?

Sign in to comment

Similar courses

Elixir & Phoenix for Beginners

Elixir & Phoenix for Beginners

Sources: knowthen.com
The above statement is conventional wisdom that I'm sure most of us programmers would generally agree with, but let me ask you this, do you think each of the 20 most popular pro...
17 hours 24 minutes 18 seconds
Developing With Elixir/OTP

Developing With Elixir/OTP

Sources: pragmaticstudio
Put Elixir and OTP into action as you build a concurrent, fault-tolerant application from scratch in this 6-hour video course from The Pragmatic Studio. If you'
6 hours 42 minutes 4 seconds
The Complete Elixir and Phoenix Bootcamp

The Complete Elixir and Phoenix Bootcamp

Sources: udemy, Stephen Grider
Elixir and Phoenix are two of the hottest technologies of 2017. Functional Programming? You will learn it. Phoenix with OAuth? Its here. Postgres for data sto
17 hours 22 minutes 4 seconds
Elixir for Programmers

Elixir for Programmers

Sources: coding-gnome.com
But you want more. True mastery of Elixir comes from understanding the underlying idioms: functional programming, transformations, concurrency, and application structure. You ne...
7 hours 19 minutes 57 seconds
Master the Linux Command-Line & Bash Scripting

Master the Linux Command-Line & Bash Scripting

Sources: Gustavo Pezzi
This course is a comprehensive immersion into the command-line of Linux and other UNIX-like systems. We'll learn the most popular shell tools and introduce concepts of Operating...
7 hours 56 minutes 19 seconds