Implementing the Twitter login in Phoenix

We'll move on to implementing our actual login and authentication code in Phoenix! First, we'll need to set up our routes. Ueberauth is expecting us to provide a route for each provider and a callback for each provider as well. In lib/vocial_web/router.ex, we'll add a brand new scope for our Ueberauth routes called /auth. This means all OAuth-specific routes will be in the format of /auth/... . This also helps us segment away the code that deals specifically with Ueberauth's login details: 

  scope "/auth", VocialWeb do    pipe_through :browser    get "/:provider", SessionController, :request    get "/:provider/callback", SessionController, :callback  end

Next, we'll need to modify the aforementioned SessionController. ...

Get Phoenix Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.