Skip to content

Commit 7c958de

Browse files
Merge pull request #1932 from habitat-sh/oauth_error
do not swallow oauth provider errors. let their light shine
2 parents f514f07 + d68adb2 commit 7c958de

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

components/builder-api/src/server/resources/authenticate.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@ async fn authenticate(path: Path<String>, state: Data<AppState>) -> HttpResponse
4949

5050
match do_authenticate(&code, &state).await {
5151
Ok(session) => HttpResponse::Ok().json(session),
52-
Err(Error::OAuth(OAuthError::HttpResponse(_code, _response))) => {
53-
HttpResponse::new(StatusCode::UNAUTHORIZED)
52+
Err(Error::OAuth(OAuthError::HttpResponse(_code, response))) => {
53+
// Include the oauth provider error response in the HTTP response
54+
HttpResponse::build(StatusCode::UNAUTHORIZED).body(response)
5455
}
5556
Err(e) => {
56-
warn!("Oauth client error, {:?}", e);
57+
warn!("OAuth client error, {:?}", e);
5758
e.into()
5859
}
5960
}

0 commit comments

Comments
 (0)