Closed belboo closed 3 years ago
Hard to see only with stacktrace, the error throw is here : https://github.com/micronaut-projects/micronaut-security/blob/623adf5a3e8a2e895373cf7a8176f1ce082f7e63/security-oauth2/src/main/java/io/micronaut/security/oauth2/endpoint/token/response/IdTokenLoginHandler.java#L83
String accessToken = parseIdToken(userDetails).orElseThrow(() -> new OauthErrorResponseException(ObtainingAuthorizationErrorCode.SERVER_ERROR, "Cannot obtain an access token", null));
go back up on stack trace let me think the response of on the openId flow failed to get the user from the access token.
I don't know more for now, please enable more log :
curl -i -X POST -H "Content-Type: application/json" \
-d '{ "configuredLevel": "TRACE" }' \
http://localhost:28081/loggers/io.micronaut.security
Many thanks for looking into this and for the fast response! Very much appreciated!
Your link to the code already helped me along - opening it I realised that I was looking at the master branch where line 80 was another overload of getCookie, the one for the refresh token flow. This was confusing me like hell.
An error in parseIdToken(userDetails).orElseThrow(...)
is also confusing because in my case is raised in the callback from the authorize
call where micronaut requests the code, which Okta faithfully returns. Not sure what's happening there (haven't run the trace level logging yet) but it seems that instead of forwarding the code to the token endpoint it tries to parse the response as if it were the token already and comes out empty.
Shall investigate further! Perhaps ditching the authentication: idtoken
line in the config would help... 🤔
Thanks again and have a wonderful evening!
For information, Don't use authentication: idtoken
, as I know it's not compatible with oauth and openid.
Ow, that's good to know! I've been copy-pasting the app config from the micronaut dev guide for Okta but perhaps its related to a different version of the framework... In any case, removing the idtoken
setting did the trick in test env. Let's see if it works with our central Okta. 🤞
Thank you for your help!
Probably my failure to configure something correctly, but would greatly appreciate a hint as to where I may be going wrong! 🙏🏽
Deployment in GCP k8s, trying to authenticate with Okta using roughly the following configuration:
and receiving the following error on
/authorize
callback:Error is:
Been blindly stumbling around randomly turning on knobs around the subjects of GCP LB header forwards and cookie storage config for micronaut JWT section but to no avail.