https://kotlinlang.org logo
#ktor
Title
# ktor
v

Vivek Modi

04/19/2022, 11:53 AM
Hey guys, How can I remove
Bearer
keyword from
authorization
token in Ktor. I don't want to use these keyword in my api call. I think it call authorization header, but I am not sure. Thanks
Copy code
install(Auth) {
    bearer {
        loadTokens {
            BearerTokens("u_b6I4kItp", "xyz111")
        }
    }
}
c

Chrimaeon

04/19/2022, 12:03 PM
This is part of the protocol to define the authentication method. You can have a look at the definition over here https://www.rfc-editor.org/rfc/rfc1945#section-11 and for OAuth2 https://www.rfc-editor.org/rfc/rfc6750#section-2.1
v

Vivek Modi

04/19/2022, 12:18 PM
Hey @Chrimaeon thanks for reply. I got it, Is there any other way to remove that header bcoz I am getting 401 in my api call
c

Chrimaeon

04/19/2022, 12:21 PM
You can create the header field on your own without the „Plugin“ then you have full control over the value. There should be a „Default Headers“ plugin that you should be able to use.
v

Vivek Modi

04/19/2022, 12:22 PM
Okk I'll try. thanks for guidance.
5 Views