Skip to content

Commit

Permalink
fix: oauth logins used incorrect scope
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenfiszel committed Jul 4, 2022
1 parent d092c62 commit 1dcba67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/src/oauth2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ pub async fn build_oauth_clients(base_url: &str) -> anyhow::Result<AllClients> {
.filter(|x| oauths.contains_key(&x.0))
.map(|(k, v)| {
let scopes = v.scopes.clone();

let named_client = build_basic_client(
k.clone(),
v,
Expand Down Expand Up @@ -725,15 +724,16 @@ fn oauth_redirect(
.ok_or_else(|| error::Error::BadRequest("client not found".to_string()))?;
let state = State::new_random();
let mut client = client_w_scopes.client.clone();
let url = client.authorize_url(&state);
let scopes_iter = if let Some(scopes) = scopes {
scopes
} else {
client_w_scopes.scopes.clone()
};

for scope in scopes_iter.iter() {
client.add_scope(scope);
}
let url = client.authorize_url(&state);
set_cookie(&state, cookies);
Ok(Redirect::to(url.as_str()))
}
Expand Down

0 comments on commit 1dcba67

Please sign in to comment.