Skip to content

Use Phoenix Sessions #252

@nelsonic

Description

@nelsonic

At present we have a function that creates a session based on the person data (after Google Auth)
lib/app_web/controllers/google_auth_controller.ex#L29-L35
But this is not adding the session to the conn and as a result the person (user) cannot perform any further action beyond Auth ...

Todo

    conn
    |> put_current_user(user)
    |> put_session(:user_id, user.id)
    |> configure_session(renew: true)
  • apps/rumbl_web/lib/rumbl_web/controllers/auth.ex

  • Save the person.id into conn then use put_session function to save the session on the user browser. The Session controller will be created later on to create the email/password authentication

  • Create a Plug that we can use on each incoming request to get the check if the session exists and still valid and to retrieve the person from the saved person.id in the session

https://github.com/nelsonic/rumbl/search?q=session

Metadata

Metadata

Assignees

Labels

T1hTime Estimate 1 Hourawaiting-reviewAn issue or pull request that needs to be reviewedenhancementNew feature or enhancement of existing functionalitytechnicalA technical issue that requires understanding of the code, infrastructure or dependencies

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions