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(),