-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using the backdoor creates two tokens #3
Comments
Sorry for the delays @tarzan, I've been out of the country and dealing with a family emergency. One of the @ueberauth/developers will help you soon! |
@tarzan what about having a To be honest, JWT + Guardian.DB is over killing for testing, you could avoid any database interaction from Guardian if you follow this approach. |
@tarzan The example assumes MyApp.Guardian.encode_and_sign(resource, claims, skip_callback: true) Also, my pull request #4 lets you workaround by passing claims directly instead of tokens. That should avoid double tokens too. |
Eventually, we decided to write our own plug for sidestepping authentication in acceptance tests. I put it in a gist right here: https://gist.github.com/tarzan/9d2aad9bb0191587ae4a31e1ded0beb7 This just serialises a user to a JWT token and can be called by implementing a login helper in ExUnit case template: def login(%{id: user_id}) do
navigate_to("/?user_id=#{user_id}")
end |
I am using
guardian
in tandem withguardian_db
to persist the JWT tokens in the database. Upon writing the acceptance tests using Hound, I ran into the following issue:hound_login()
function withguardian_db
, by implementing (among others) the following hook:This has to do with the example implementation that guides the user to first manually encode and sign a token, while the Backdoor Plug picks up on this token, extracts the token and then calls the
sign_in
of the Guardian Plug, which itself encodes and signs the token again. This seems unnecessarily complex to me, isn't it possible to shortcut this somehow?The text was updated successfully, but these errors were encountered: