From 4a30115a8b8588ccbca81474fdb36b67dcaf1284 Mon Sep 17 00:00:00 2001 From: Anders Pitman <&ers@apitman.com> Date: Fri, 13 Dec 2024 22:34:35 -0700 Subject: [PATCH] Implement custom oauth state --- atrium-oauth/oauth-client/src/oauth_client.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/atrium-oauth/oauth-client/src/oauth_client.rs b/atrium-oauth/oauth-client/src/oauth_client.rs index e844f00a..339292b7 100644 --- a/atrium-oauth/oauth-client/src/oauth_client.rs +++ b/atrium-oauth/oauth-client/src/oauth_client.rs @@ -151,7 +151,12 @@ where return Err(Error::Authorize("none of the algorithms worked".into())); }; let (code_challenge, verifier) = Self::generate_pkce(); - let state = generate_nonce(); + + let state = match options.state { + Some(state) => state, + None => generate_nonce(), + }; + let state_data = InternalStateData { iss: metadata.issuer.clone(), dpop_key: dpop_key.clone(),