...

/

Generate the Authentication Layer

Generate the Authentication Layer

Learn how to use generators and develop authentication layer for user identification.

In the following lessons, we’ll learn how to use the generator to build an authentication layer, we’ll see how the pieces of generated code fit together to handle the responsibilities of authentication, and we’ll even see how LiveView uses the authentication service to identify and operate on the logged-in user.

What is phx.gen.auth?

To build a well-structured authentication layer for Phoenix requests, we can use the phx.gen.auth application generator. This generator is rapidly becoming the authentication standard for all Phoenix applications. Though phx.gen.auth is not a LiveView framework, all LiveViews begin as standard web requests. That means a plug-based approach suits our purposes just fine to authenticate our users in ...