-
Notifications
You must be signed in to change notification settings - Fork 23
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
Access Token being checked even on endpoints not calling access_token_required! #9
Comments
Same here. Authentication processed regardless Update: This is probably caused Middleware that inject itself calls Bearer "authorization" method automatically. When that happens, Grape thinks you want authentication. For the time being, the only workaround is using include in only specific endpoints. I hope we can get @nbulaj' s attention here. |
@johnbrun09 @gencer thanks for the reporting, I will check it ASAP. |
@johnbrun09 can yo please provide full code listing for the module where you are injecting |
Since no reply made. Let me gave you mine:
|
@gencer @johnbrun09 what am I doing wrong? https://gist.github.com/nbulaj/ff3716d1043143c01b2237c4fa34517a I've added two endpoints to simple Grape API, one public and one protected (after injecting Grape::OAuth2), and tested it with rackup and curl. |
The gist you prepared is the same scheme I used. Only difference (not wrong) is how we used it. For me; I use it with Rails5. Maybe Rails has something to do with this or some gem interfere? Because, I am positively sure that mounting api endpoints after oauth.api, makes all mounts authenticable. But before them is public. Should I prepare a skeleton/sample project for you maybe? |
@gencer it will be great, because it's hard for me to find a concrete problem without knowing all the environment. |
Hi @gencer . Any update here? |
@nbulaj, I completely forgot about this. I was switched to doorkeeper at that time. However, I just illustrated a sample on my end and it seems it just passes my test. However, I can't remember exactly what was my previous environment like which was failed as this issue stated 🤕. |
I call access_token_required! in several of my api endpoints, but not in the UserLogin endpoints.
if I do the following
I get a 401 error when attempting to log in, even though access_token_required! is not being used in that file.
If I do the following instead
Then the user login controller is called without checking for an access token.
The text was updated successfully, but these errors were encountered: