I’m trying to use new Bearer based authorisation <...
# ktor
a
I’m trying to use new Bearer based authorisation https://ktor.io/docs/auth.html#bearer. Wondering why we need to have
refreshToken
in
BearerTokens
. I don’t found an usage inside library. In my case I’m storing and refreshing tokens on application side.
💯 1
a
The
refreshTokens
lambda indirectly used here when a server responds with
401 Unauthorized
status code.
a
Yes, it is how it is used, but I’m talking about field in
BearerTokens
object returned from lambda, not lambda itself.
Copy code
public class BearerTokens(
    public val accessToken: String,
    public val refreshToken: String
)
a
This is made for convenient retrieval of a refresh token after it has been loaded with a
loadTokens
or
refreshTokens
lambda.
There are no usages because the whole object is saved.
a
So, it is just to store refreshToken for future. to take it inside
refreshTokens
lambda and make an request for new accessToken.
a
Yes, except that there is no access to a
BearerTokens
 instance inside
refreshTokens
lambda.
a
So, what the reason then? 🙂
a
I don't know. @e5l, please explain.
a
Hey, @e5l, Could you provide an idea why do we need to return BearerTokens with
refrestToken
field if it is not used and can’t be retrieved back.
👀 2
e
Yep, It looks like the origin intention was not clearly implemented
We should either remove
BearerToken
or pass it to the
refreshToken
lambda
🙇 1
@Aleksei Tirman [JB], could you file an issue about API cleanup?
a
👍 Thanks. Would be great, because now it is confusing when you start to work with it.
a