Skip to content

Commit

Permalink
Fix state test
Browse files Browse the repository at this point in the history
  • Loading branch information
stephank committed Feb 27, 2024
1 parent e712d3f commit 07f4d8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ async fn main() {
match cmd[0] {
"echo" => println!("ok\t{}", cmd[1]),
"auth" => match client.start_auth(&cmd[1]).await {
Ok(url) => println!("ok\t{}", url),
Ok(mut url) => {
url.query_pairs_mut()
.append_pair("state", cmd.get(2).cloned().unwrap_or_default());
println!("ok\t{}", url);
}
Err(err) => println!("err\t{}", err),
},
"verify" => match client.verify(&cmd[1]).await {
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ impl Client {
/// If performing the redirect in the HTTP response, the recommended method is to send a 303
/// HTTP status code with the `Location` header set to the URL. But other solutions are
/// possible, such as fetching this URL using a request from client-side JavaScript.
///
/// The caller may add a `state` query parameter to the returned URL, which is passed verbatim
/// to the redirect URI after the user returns.
pub async fn start_auth(&self, email: &str) -> Result<Url, StartAuthError> {
let discovery = self
.store
Expand Down

0 comments on commit 07f4d8b

Please sign in to comment.