sttp-oauth2
sttp-oauth2 copied to clipboard
PasswordGrant fails to decode user_name
Exception in thread "main" com.ocadotechnology.sttp.oauth2.common$OAuth2Exception: Client call resulted in error (200): Missing required field: DownField(user_name)
at com.ocadotechnology.sttp.oauth2.PasswordGrantProvider$.$anonfun$apply$5(PasswordGrantProvider.scala:30)
at cats.syntax.EitherOps$.leftMap$extension(either.scala:193)
at com.ocadotechnology.sttp.oauth2.PasswordGrantProvider$.$anonfun$apply$4(PasswordGrantProvider.scala:30)
at sttp.client3.monad.IdMonad$.map(IdMonad.scala:8)
at sttp.monad.syntax$MonadErrorOps.map(MonadError.scala:60)
at com.ocadotechnology.sttp.oauth2.PasswordGrantProvider$.$anonfun$apply$2(PasswordGrantProvider.scala:30)
at sttp.monad.syntax$MonadErrorOps.flatMap(MonadError.scala:61)
at com.ocadotechnology.sttp.oauth2.PasswordGrantProvider$.$anonfun$apply$1(PasswordGrantProvider.scala:31)
at OauthTest$.main(OauthTest.scala:18)
at OauthTest.main(OauthTest.scala)
Caused by: com.ocadotechnology.sttp.oauth2.common$Error$HttpClientError: Client call resulted in error (200): Missing required field: DownField(user_name)
at com.ocadotechnology.sttp.oauth2.common$.$anonfun$responseWithCommonError$1(common.scala:103)
at sttp.client3.MappedResponseAs.$anonfun$mapWithMetadata$1(ResponseAs.scala:91)
at sttp.client3.internal.BodyFromResponseAs.$anonfun$doApply$2(BodyFromResponseAs.scala:24)
at sttp.client3.monad.IdMonad$.map(IdMonad.scala:8)
at sttp.monad.syntax$MonadErrorOps.map(MonadError.scala:60)
at sttp.client3.internal.BodyFromResponseAs.doApply(BodyFromResponseAs.scala:24)
at sttp.client3.internal.BodyFromResponseAs.$anonfun$apply$1(BodyFromResponseAs.scala:14)
at sttp.monad.syntax$MonadErrorOps.map(MonadError.scala:60)
at sttp.client3.internal.BodyFromResponseAs.apply(BodyFromResponseAs.scala:14)
at sttp.client3.HttpURLConnectionBackend.readResponse(HttpURLConnectionBackend.scala:245)
at sttp.client3.HttpURLConnectionBackend.$anonfun$send$1(HttpURLConnectionBackend.scala:56)
at scala.util.Try$.apply(Try.scala:209)
at sttp.monad.MonadError.handleError(MonadError.scala:24)
at sttp.monad.MonadError.handleError$(MonadError.scala:23)
at sttp.client3.monad.IdMonad$.handleError(IdMonad.scala:6)
at sttp.client3.SttpClientException$.adjustExceptions(SttpClientException.scala:58)
at sttp.client3.HttpURLConnectionBackend.adjustExceptions(HttpURLConnectionBackend.scala:295)
at sttp.client3.HttpURLConnectionBackend.send(HttpURLConnectionBackend.scala:30)
at sttp.client3.HttpURLConnectionBackend.send(HttpURLConnectionBackend.scala:22)
at sttp.client3.FollowRedirectsBackend.sendWithCounter(FollowRedirectsBackend.scala:29)
at sttp.client3.FollowRedirectsBackend.send(FollowRedirectsBackend.scala:24)
at com.ocadotechnology.sttp.oauth2.PasswordGrant$.$anonfun$requestToken$1(PasswordGrant.scala:40)
at sttp.monad.syntax$MonadErrorOps.map(MonadError.scala:60)
at com.ocadotechnology.sttp.oauth2.PasswordGrant$.requestToken(PasswordGrant.scala:42)
at com.ocadotechnology.sttp.oauth2.PasswordGrantProvider$.$anonfun$apply$3(PasswordGrantProvider.scala:29)
... 6 more
Caused by: sttp.client3.DeserializationException: Missing required field: DownField(user_name)
at sttp.client3.ResponseAs$.$anonfun$deserializeWithError$1(ResponseAs.scala:201)
at sttp.client3.ResponseAs$.$anonfun$deserializeRightWithError$1(ResponseAs.scala:180)
at sttp.client3.MappedResponseAs.$anonfun$mapWithMetadata$1(ResponseAs.scala:91)
... 30 more
Originally posted by @reoxu in https://github.com/ocadotechnology/sttp-oauth2/issues/335#issuecomment-1376877020
@reoxu what authentication provider do you using? where do you try to log in?