You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val authCode =WebAuthProvider.authorizeWithPAR(account)
344
+
val authCode =WebAuthProvider.authorizeWithRequestUri(account)
344
345
.await(context, requestUri)
345
346
346
347
// Step 4: Send code to BFF to exchange for tokens
@@ -358,6 +359,92 @@ try {
358
359
> [!NOTE]
359
360
> The SDK only handles opening the browser with the `request_uri` and returning the authorization code. Token exchange must be performed by your backend server which holds the `client_secret`.
360
361
362
+
### PAR with PKCE
363
+
364
+
When using PAR with PKCE (Proof Key for Code Exchange), your backend generates a `code_verifier` and `code_challenge` during the `/par` request, and includes the `code_verifier` when exchanging the authorization code for tokens.
365
+
366
+
The PKCE flow adds an extra layer of security by ensuring that only the party that initiated the authorization request can exchange the code for tokens.
367
+
368
+
```kotlin
369
+
// Step 1: Your BFF calls /par with code_challenge and returns request_uri + code_verifier
370
+
val parResponse = yourBffClient.initiatePARWithPKCE(scope, audience)
371
+
// parResponse contains: requestUri and codeVerifier
0 commit comments