Skip to content

Commit

Permalink
support oauth without a refresh_url
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtbuilds committed Dec 26, 2023
1 parent af19c8d commit 12232fe
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions core/src/extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ fn extract_key_location(loc: &APIKeyLocation, name: &str) -> AuthLocation {
}

pub fn extract_security_strategies(spec: &OpenAPI) -> Vec<AuthStrategy> {
dbg!("extracting security", &spec.security);
let mut strats = vec![];
let schemes = &spec.security_schemes;
for requirement in &spec.security {
Expand Down Expand Up @@ -413,7 +412,7 @@ pub fn extract_security_strategies(spec: &OpenAPI) -> Vec<AuthStrategy> {
strats.push(AuthStrategy::OAuth2(Oauth2Auth {
auth_url: flow.authorization_url.clone(),
exchange_url: flow.token_url.clone(),
refresh_url: flow.refresh_url.as_ref().expect("Must have refresh URL").clone(),
refresh_url: flow.refresh_url.clone().unwrap_or_else(|| flow.token_url.clone()),
scopes: flow.scopes.iter().map(|(k, v)| (k.clone(), v.clone())).collect(),
}))
}
Expand Down

0 comments on commit 12232fe

Please sign in to comment.