-
Notifications
You must be signed in to change notification settings - Fork 339
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
Debugging 500 internal error from auth/oauth2/token ? #131
Comments
@10000TB |
Is there a traceback in the terminal or in the HTTP/500 response itself (use browser inspector "network" tab)? Can you run the server in debug mode? (It is the default, but you might have disabled DEBUG in your |
I tried in debug mode, and looked around the places you mentioned, but sadly, could get an end debug info, I feel the auth token request is worth more logging. Details:
In browser
|
Found the issue accidentally The 500 error happens only in swagger ui, when I check non-continuous oauth scopes ( say in the UI, we have scopes like: Intermittently, I was seeing some console logs like "auth scopes were invalid", I recall in the error case above, it send auth scopes to server as {'A:read', 'A:write', '', '', 'C:read', 'C:write'}, and looked it set missing/unchecked scope as '' ? which caused the server error - and It was not always logged ? at least from my observation |
I recall having an issue like that, but I don't remember how and whether I solved it. I will dig into it tomorrow. |
Thanks @frol ! feel free to pass down pointers/clues, and maybe I can take it up Love to contribute! |
@10000TB Please, give the fix a try. It is unfortunate, but I would say that the bug is on Swagger UI 2.x side, it should not add extra spaces between scopes in the
|
I see BTW, did you know what places actually does the “space” part in swagger UI 2.x ? - would it be feasible apply a patch within this project ? (within swagger UI download task, say after we download swagger UI and extract and save it to static folder, then do some pattern search and replace against some .js file to fix the broken function every time) |
@10000TB I don't know the exact line of code, but I am sure it is easy to track it down (I recall I was already looking into the issue but dropped it as it was not that important for me at that point). However, it would be problematic to apply the patch to the minified version of the JS, which is why I opted to apply a hack on the backend side. |
I see, that make sense Do you mind sharing clues/hints about where to hack on backend to workaround this issue ? Where I am confused in terms Of how to hack: it seems to me that scopes values are directly handled by upstream flask-oauthlib in its oauth2.py - and this project’s endpoint (south/token) processing does nothing by delegating the logic via token_handler decorator |
BTW, is the hack you mentioned here related to the fix you mentioned above ?
|
Ah, you seem to miss the commit: 1071254 |
Enlightened , 👍
|
I am constantly getting 500 error for password type tokens request against
auth/oauth2/token
, and trying to figure out what went wrong (no change in auth module at all, and start getting such error), so naturally I start trying adding logging, but could not figure out how, does anyone here know how?looking at this function from
app/modules/auth/views.py
the only logging does not seem to print anything in console.
Can anyone kindly offer anything I can try to debug further ?
The text was updated successfully, but these errors were encountered: