Hello, I have a problem with `Auth` plugin for KMM...
# ktor
r
Hello, I have a problem with
Auth
plugin for KMM client. The RefreshToken lambda isn’t called.
Copy code
RESPONSE: 401 Unauthorized
                 METHOD: HttpMethod(value=GET)
                 FROM: xxxxx
                 COMMON HEADERS
                 -> accept: application/json
                 -> accept-charset: UTF-8
                 -> accept-encoding: gzip
                 -> access-control-allow-headers: authorization,Access-Control-Allow-Origin,Content-Type,SOAPAction,apikey,Internal-Key,testKey,Authorization
                 -> access-control-allow-methods: GET
                 -> access-control-allow-origin: *
                 -> access-control-expose-headers: 
                 -> connection: keep-alive
                 -> content-type: application/json; charset=UTF-8
                 -> date: Tue, 03 Jan 2023 16:33:12 GMT
                 -> transfer-encoding: chunked
                 -> www-authenticate: OAuth2 realm="XXXX", error="invalid_token", error_description="The access token expired"
                 BODY Content-Type: application/json; charset=UTF-8
                 BODY START
                 {"fault":{"code":900901,"message":"Invalid Credentials","description":"Access failure for API: /xxxx/setups/1.9, version: 1.9 status: (900901) - Invalid Credentials. Make sure you have provided the correct security credentials"}}
                 BODY END
With this response, it should be called ?
a
The problem is that the server responds with the
www-authenticate
header which contains the
OAuth2
auth scheme. The
refreshTokens
lambda is called only if the auth scheme is
Bearer
.
r
Can I change the header in the validateResponse ? Thank’s for the clarification
a
No. But you can use this workaround to modify the
www-authenticate
response header.
r
Thank’s, will try !