Skip to content

Commit b5327a7

Browse files
committed
Update query params for oauth login
version bump
1 parent 4cab693 commit b5327a7

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "supabase-auth"
33
authors = ["Eric Biggs"]
44
description = "Supabase Auth implementation following the official client libraries."
55
readme = "README.md"
6-
version = "0.10.7"
6+
version = "0.10.8"
77
edition = "2021"
88
license = "MIT OR Apache-2.0"
99
keywords = ["supabase", "supabase-auth", "authentication", "auth"]

src/client.rs

+19-4
Original file line numberDiff line numberDiff line change
@@ -453,14 +453,29 @@ impl AuthClient {
453453
headers.insert(CONTENT_TYPE, HeaderValue::from_str("application/json")?);
454454
headers.insert("apikey", HeaderValue::from_str(&self.api_key)?);
455455

456+
let query_params = options.as_ref().map_or_else(
457+
|| vec![("provider", provider.to_string())],
458+
|o| {
459+
let mut params = vec![("provider", provider.to_string())];
460+
461+
if let Some(ref redirect) = o.redirect_to {
462+
params.push(("email_redirect_to", redirect.to_string()));
463+
}
464+
465+
if let Some(ref extra) = o.query_params {
466+
params.extend(extra.iter().map(|(k, v)| (k.as_str(), v.to_string())));
467+
}
468+
469+
params
470+
},
471+
);
472+
456473
let body = serde_json::to_string(&options)?;
457474

458475
let response = self
459476
.client
460-
.get(format!(
461-
"{}{}/authorize?provider={}",
462-
self.project_url, AUTH_V1, provider
463-
))
477+
.get(format!("{}{}/authorize", self.project_url, AUTH_V1))
478+
.query(&query_params)
464479
.headers(headers)
465480
.body(body)
466481
.send()

0 commit comments

Comments
 (0)