Skip to content

Commit

Permalink
Fix comments about csrf_state
Browse files Browse the repository at this point in the history
Clarify that the `state` parameter should be compared to the
`csrf_token.secret()`.

Fixes #208.
  • Loading branch information
Ike McCreery committed Jan 15, 2024
1 parent e24e255 commit bf6b9fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
//!
//! // Once the user has been redirected to the redirect URL, you'll have access to the
//! // authorization code. For security reasons, your code should verify that the `state`
//! // parameter returned by the server matches `csrf_state`.
//! // parameter returned by the server matches `csrf_token.secret()`.
//!
//! // Now you can trade it for an access token.
//! let token_result =
Expand Down Expand Up @@ -202,7 +202,7 @@
//!
//! // Once the user has been redirected to the redirect URL, you'll have access to the
//! // authorization code. For security reasons, your code should verify that the `state`
//! // parameter returned by the server matches `csrf_state`.
//! // parameter returned by the server matches `csrf_token.secret()`.
//!
//! // Now you can trade it for an access token.
//! let token_result = client
Expand Down Expand Up @@ -259,7 +259,7 @@
//!
//! // Once the user has been redirected to the redirect URL, you'll have the access code.
//! // For security reasons, your code should verify that the `state` parameter returned by the
//! // server matches `csrf_state`.
//! // server matches `csrf_token.secret()`.
//!
//! # Ok(())
//! # }
Expand Down
2 changes: 1 addition & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ new_secret_type![
new_secret_type![
///
/// Value used for [CSRF](https://tools.ietf.org/html/rfc6749#section-10.12) protection
/// via the `state` parameter.
/// via the `state` parameter. Compare the `state` parameter to `self.secret()`.
///
#[must_use]
#[derive(Clone, Deserialize, Serialize)]
Expand Down

0 comments on commit bf6b9fb

Please sign in to comment.