Google Callback Error
pausanchezv opened this issue · comments
Hello,
Sometimes, no matter what I do, I receive this error and my users can't log in:
File "/usr/local/lib/python3.10/site-packages/fastapi_sso/sso/base.py", line 350, in verify_and_process
raise SSOLoginError(400, "'code' parameter was not found in callback request")
Please, note that I always use the latest version and I've been coming across this error in all versions.
Thank you.
Hi! This is a pickle, because it is usually difficult to debug the callback, because you don't have much to work with (you have no response, the provider actually sends request to you).
I believe there may be more info in the header / query string, but I don't think there's an easy way in fastapi-sso to log this 🤔 There are some issues and PRs open, I will try to smuggle some increased logging in the next release so that you can turn it on and find out what's going on.
I will release a logging of callback request params and headers in the next version, you can try running it like this:
import logging
logging.basicConfig(level=logging.DEBUG)
# rest of your code
If the request does not contain code
, you will get more info. Please note that the logs may contain some sensitive information, so check it before posting. Also, could you please specify which provider is generating the problem? Is this FacebookSSO?
Please try with debug logging using 0.15.0 https://github.com/tomasvotava/fastapi-sso/releases/tag/0.15.0
https://github.com/tomasvotava/fastapi-sso/releases/tag/0.15.0
Hi, it's both, I have an email sent every time it crashes and a user can't log in. Usually I receive like 4 emails per day which is a bit too much. You can try it out yourself on my website as this is maybe the best way to see it (if it happens to you):
https://app.useofenglishpro.com
Also here are the screenshots:
Also here's my implementation, in case it helps (it's the same thing for facebook):
This last Raise is the one that gets the email sent and line 41 is the one that crashes.
Then, the next snippet, show what's crashing in your library:
Hope it helps!
Pau.
Like I said in #173, we'll need to know more on what the provider is sending back to you. Please try using the aforementioned 0.15.0 release along with logging.DEBUG
level. Please make sure the logs do not contain any sensitive information before you post them.