feat: Allow custom GitHub OAuth app client ID via environment variable (#145)

* feat: Allow custom GitHub OAuth app client ID via environment variable

* docs: describe how to use your own github oauth app id

* docs: update to cover backend and frontend settings

* fix: run cargo fmt

---------

Co-authored-by: Weston Platter <weston@westonplatter.com>
This commit is contained in:
Weston Platter
2025-07-15 23:11:13 -06:00
committed by GitHub
parent ea7cb76059
commit b5303b728e
2 changed files with 34 additions and 5 deletions

View File

@@ -36,10 +36,9 @@ struct DevicePollRequest {
/// POST /auth/github/device/start
async fn device_start() -> ResponseJson<ApiResponse<DeviceStartResponse>> {
let params = [
("client_id", "Ov23li9bxz3kKfPOIsGm"),
("scope", "user:email,repo"),
];
let client_id = option_env!("GITHUB_CLIENT_ID").unwrap_or("Ov23li9bxz3kKfPOIsGm");
let params = [("client_id", client_id), ("scope", "user:email,repo")];
let client = reqwest::Client::new();
let res = client
.post("https://github.com/login/device/code")
@@ -105,8 +104,10 @@ async fn device_poll(
State(app_state): State<AppState>,
Json(payload): Json<DevicePollRequest>,
) -> ResponseJson<ApiResponse<String>> {
let client_id = option_env!("GITHUB_CLIENT_ID").unwrap_or("Ov23li9bxz3kKfPOIsGm");
let params = [
("client_id", "Ov23li9bxz3kKfPOIsGm"),
("client_id", client_id),
("device_code", payload.device_code.as_str()),
("grant_type", "urn:ietf:params:oauth:grant-type:device_code"),
];