Skip to content

Commit 6462f14

Browse files
committed
fix: wrong client app registration endpoint
POST /api/v2/oauth2-provider/apps is actually for manual admin registration for admin created apps. Programmatic Dynamic Client Registration is done via `POST /oauth2/register`. At the same time I included `registration_access_token` and `registration_client_uri` to use it later in order to refresh the client secret without re-registering the client app.
1 parent 2a28cee commit 6462f14

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/kotlin/com/coder/toolbox/oauth/ClientRegistrationResponse.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ data class ClientRegistrationResponse(
1717
@field:Json(name = "scope") val scope: String,
1818
@field:Json(name = "token_endpoint_auth_method") val tokenEndpointAuthMethod: String,
1919
@field:Json(name = "client_id_issued_at") val clientIdIssuedAt: Long?,
20-
@field:Json(name = "client_secret_expires_at") val clientSecretExpiresAt: Long?
20+
@field:Json(name = "client_secret_expires_at") val clientSecretExpiresAt: Long?,
21+
@field:Json(name = "registration_client_uri") val registrationClientUri: String,
22+
@field:Json(name = "registration_access_token") val registrationAccessToken: String
2123
)

src/main/kotlin/com/coder/toolbox/oauth/CoderAuthorizationApi.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ import retrofit2.Response
44
import retrofit2.http.Body
55
import retrofit2.http.GET
66
import retrofit2.http.POST
7-
import retrofit2.http.Url
87

98
interface CoderAuthorizationApi {
109
@GET(".well-known/oauth-authorization-server")
1110
suspend fun discoveryMetadata(): Response<AuthorizationServer>
1211

13-
@POST
12+
@POST("oauth2/register")
1413
suspend fun registerClient(
15-
@Url url: String,
1614
@Body request: ClientRegistrationRequest
1715
): Response<ClientRegistrationResponse>
1816
}

0 commit comments

Comments
 (0)