Advertisement
SimpleCookie

Untitled

Feb 13th, 2024
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.72 KB | None | 0 0
  1. import org.springframework.http.HttpHeaders
  2. import org.springframework.http.MediaType
  3. import org.springframework.web.reactive.function.BodyInserters
  4. import org.springframework.web.reactive.function.client.WebClient
  5. import reactor.core.publisher.Mono
  6.  
  7. fun revokeToken(accessToken: String, clientId: String): Mono<Void> {
  8.     val client = WebClient.create("https://api/revoke") // Replace with actual revoke endpoint
  9.  
  10.     val body = BodyInserters.fromFormData("token", accessToken)
  11.         .with("token_type_hint", "access_token")
  12.         .with("client_id", clientId)
  13.  
  14.     return client.post()
  15.         .contentType(MediaType.APPLICATION_FORM_URLENCODED)
  16.         .body(body)
  17.         .retrieve()
  18.         .toBodilessEntity()
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement