Skip to content

How to resolve :redirect_if_authenticated in your full example ? #68

@tobiasdroessler

Description

@tobiasdroessler

Hi, am new to that language, framework and topic.

I want to upgrade an existing minimal app to work with OAuth and failed with:

 mix compile
Compiling 2 files (.ex)
warning: variable "conn" is unused (there is a variable with the same name in the context, use the pin operator (^) to match on it or prefix this variable with underscore if it is not meant to be used)
  lib/pcm_limit_classes_web/controllers/auth_controller.ex:125: PcmLimitClassesWeb.AuthController.valid_state_token?/2

== Compilation error in file lib/pcm_limit_classes_web/router.ex ==
** (CompileError) lib/pcm_limit_classes_web/router.ex:1: undefined function redirect_if_authenticated/2 (expected PcmLimitClassesWeb.Router to define such a function or for it to be imported, but none are available)

how to resolve this :redirect_if_authenticated in the router file ? ..

# Routes in lib/my_app_web/router.ex
scope "/auth", MyAppWeb do
  pipe_through [:browser, :redirect_if_authenticated]
  
  get "/google", AuthController, :request
  get "/google/callback", AuthController, :callback
  get "/logout", AuthController, :logout
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions