Skip to content

Testing login: session data #604

Answered by mhanberg
aidalgol asked this question in Q&A
Discussion options

You must be logged in to vote

Assuming you are using Phoenix or Plug, you're session cookie is most likely encoded and/or encrypted. You could figure out some way using the Plug.Crypto module to decode it, but that wouldn't seem worth it to me.

What I would do is log in and assert that something on the page is specific to that user, like a name.

Or, if your auth solution keeps track of sessions in your database you could log in and then assert that a session record is stored in the database.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@aidalgol
Comment options

Answer selected by aidalgol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants