Hi all, I've been working on a project where I'm u...
# ktor
a
Hi all, I've been working on a project where I'm using ktor and I'm implementing Oauth. I've implemented my own login system in the back of it and I'm using [ory/hydra](https://github.com/ory/hydra) as an oauth flow manager. My problem is that I've followed the Oauth implementation [tutorials](https://ktor.io/features/authentication/oauth.html) and have read the whole code for the Google Oauth example, but my principal from
call.authentication.principal
is always null and I don't know where to start in debugging it...
d
Yeah, I agree that right now it is a bit hard to debug. I had some troubles too until I got it working and wrote the documentation. Your best bet right now is to put some breakpoints inside the oauth code after the http calls and see the responses or check the testing link here: https://ktor.io/quickstart/guides/oauth.html#testing And provide an HTTP client that intercepts requests so you can actually check and dump the request and the response to try to figure out what’s going wrong
a
The thing is hydra logs everything as successful, so it's not even that the wrong query is being sent. I'm using the Apache Http client
d
well, maybe there are some fields missing in the response or so
if you already have the output dumps
you can check the implementation and see if it expect something that it is missing
a
can you point me to an example of intercepting the Http client?
uhm
didn’t hydra dump the output? or only tells you: it’s ok?
this is the updated version
sorry
The idea is to use the MockEngine
a
it only says it's ok and on error it logs error_code and error_hint
Ah ok I see
d
Okay. If you provide a MockEngine, you can create a HttpClient, and redirecting there
and dump the results
a
cool, I'll give that a try, thanks
d
Also in there you have valid examples of what’s expected. Also if you can configure hydra to not use https, and run it locally, you can also use wireshark to see the http requests: https://www.wireshark.org/
a
I am running hydra locally right now, I'll give that a shot as well
👍 1
🙂