Skip to content

Commit

Permalink
Update query params for oauth login
Browse files Browse the repository at this point in the history
version bump
  • Loading branch information
Proziam committed Jan 23, 2025
1 parent 4cab693 commit b5327a7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "supabase-auth"
authors = ["Eric Biggs"]
description = "Supabase Auth implementation following the official client libraries."
readme = "README.md"
version = "0.10.7"
version = "0.10.8"
edition = "2021"
license = "MIT OR Apache-2.0"
keywords = ["supabase", "supabase-auth", "authentication", "auth"]
Expand Down
23 changes: 19 additions & 4 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,14 +453,29 @@ impl AuthClient {
headers.insert(CONTENT_TYPE, HeaderValue::from_str("application/json")?);
headers.insert("apikey", HeaderValue::from_str(&self.api_key)?);

let query_params = options.as_ref().map_or_else(
|| vec![("provider", provider.to_string())],
|o| {
let mut params = vec![("provider", provider.to_string())];

if let Some(ref redirect) = o.redirect_to {
params.push(("email_redirect_to", redirect.to_string()));
}

if let Some(ref extra) = o.query_params {
params.extend(extra.iter().map(|(k, v)| (k.as_str(), v.to_string())));
}

params
},
);

let body = serde_json::to_string(&options)?;

let response = self
.client
.get(format!(
"{}{}/authorize?provider={}",
self.project_url, AUTH_V1, provider
))
.get(format!("{}{}/authorize", self.project_url, AUTH_V1))
.query(&query_params)
.headers(headers)
.body(body)
.send()
Expand Down

0 comments on commit b5327a7

Please sign in to comment.