Add OAuth2/Space client authentication
See original GitHub issueSubsystem Client
Is your feature request related to a problem? Please describe. There is no oauth2 client authentication, and especially JetBrains Space auth
Describe the solution you’d like I’d like to have smth like
val spaceClient = client.config {
Auth {
Space(clientId, clientSecret)
}
}
actually to authenticate in Space I have to do smth like
private data class AccessToken(val token_type: String, val expires_in: Int, val access_token: String)
private suspend fun issueAccessToken(endpoint: String, clientId: String, clientSecret: String): AccessToken {
return client.submitForm(
url = "${endpoint}/oauth/token",
formParameters = Parameters.build {
append("grant_type", "client_credentials")
append("scope", "**")
}
) {
header(
HttpHeaders.Authorization,
HttpAuthHeader.Single(
AuthScheme.Basic,
String(Base64.getEncoder().encode("$clientId:$clientSecret".toByteArray()))
).render()
)
}
}
and later on for each query use
private fun HttpRequestBuilder.authHeader() {
header(
HttpHeaders.Authorization,
HttpAuthHeader.Single(issueAccessToken.token_type, issueAccessToken.access_token).render()
)
}
Motivation to include to ktor OAuth2 is quite common auth way
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Using OAuth 2.0 for Server to Server Applications | Authorization
If you have a Google Workspace account, an administrator of the organization can authorize an application to access user data on behalf of...
Read more >Add Authentication To Your iOS Apps with Centralized Login
In this tutorial we implement centralized logins for iOS both manually and using the Auth0 SDK.
Read more >AM 6 > OAuth 2.0 Guide - ForgeRock Backstage
In the AM console, navigate to Realms > Realm Name > Applications > OAuth 2.0. Click Add Client, and then provide the Client...
Read more >The OAuth2 Filter | Edge Stack
OAuth client settings · "HeaderPassword" : Treat the client secret (below) as a password, and pack that in to an HTTP header for...
Read more >OAuth 2.0 Client Authentication - Takahiko Kawasaki - Medium
In traditional ways, to begin with, an authorization server generates a pair of client ID and client secret and gives the pair to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is there any update regarding this issue?
To crosslink the progress:
OAuthAuthProvider
but was only merged into a private branch by @e5lAuthScheme.Bearer
which is needed byOAuthAuthProvider
but is not merged yet