-
Notifications
You must be signed in to change notification settings - Fork 136
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
Cannot use actingAs unit tests functionality #161
Comments
@pjhartin - I'm not entirely sure how to help here. If you're using an Auth0 JWT, then you would not ever be able to generate a new one as you don't have our signing keys.
That's a different issue than an invalid one. I'm not sure how to address that. I'm guessing that You can try the https://github.com/auth0/laravel-auth0/tree/change-user-model |
@joshcanhelp had the same problem. We chose to not implement the middleware and instead implement the Guard "auth0" which remove all problems while testing and giving the more native way of authentication in laravel since 5.1 below is our Auth0 Guard. Maybe this helps you some. you can do "auth:auth0" as middleware once the guard is defined EDIT: removed |
@Tamrael - That was linking somewhere strange. Would you mind posting that in a Gist? |
@joshcanhelp sorry for that. the "code" markup didn't want to work and my brain farted and uploaded the php as text file. Here is the gist |
@Tamrael - No problem! I've just never seen that before and the random link to a random file had me worried for a sec 😄Thank you for the Gist and your way of working around this. Do you think it would make sense to have that as part of this library? If so, would you be willing to add your solution as a PR here? Would be helpful to have some documentation on how it works as well. |
@joshcanhelp sure thing. it'll take me a few but i'll send you a pull request. where/how would want the documentation? as file in the pull request or separated? |
@joshcanhelp while working on that pull request I redesigned most of the guard into a single extend on the register. no whole guard-file required that implements a lot of things we don't actually need |
I think the guard solution above should solve this. It's merged and ready to try out in |
Just to give a confirmation, we are now able to use Thank you for the hard work. |
Forgive my naiveness on this, but I've tried to use the |
Description
I am having issues getting the
actingAs($user)
functionality working in our http unit tests since using the Auth0 implementation.Our API uses the CheckJWT middleware outlined in Auth0's Laravel API auth guide. This middleware expects a Bearer token to authenticate the user.
We are always receiving a 401 - Unauthenticated and can see that the middleware is still being processed and obviously failing due to no Bearer token being sent.
What are our options in this regard?
Example implementation
Environment
"auth0/login": "~5.0"
"laravel/framework": "^6.0
The text was updated successfully, but these errors were encountered: