Skip to content

Commit e7d079a

Browse files
committed
Fix Github Auth
1 parent 6629601 commit e7d079a

File tree

1 file changed

+4
-2
lines changed
  • atcoder-problems-backend/src/server

1 file changed

+4
-2
lines changed

atcoder-problems-backend/src/server/auth.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ struct TokenResponse {
2828
#[derive(Deserialize, Default)]
2929
pub struct GitHubUserResponse {
3030
pub(crate) id: i64,
31-
_login: String,
3231
}
3332

3433
#[derive(Clone)]
@@ -60,7 +59,10 @@ impl Authentication for GitHubAuthentication {
6059
}
6160
async fn get_user_id(&self, access_token: &str) -> Result<GitHubUserResponse> {
6261
let token_header = format!("token {}", access_token);
63-
let client = reqwest::Client::new();
62+
let client = reqwest::Client::builder()
63+
.user_agent("AtCoder Problems")
64+
.build()
65+
.map_err(error::ErrorInternalServerError)?;
6466
let response: GitHubUserResponse = client
6567
.get("https://api.github.com/user")
6668
.header("Authorization", token_header)

0 commit comments

Comments
 (0)