Skip to content

Commit 86f599e

Browse files
committed
Feat: launch authorization
1 parent 16c70ca commit 86f599e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/cmd/auth.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ struct AuthInitResponse {
5656
pub async fn run_auth(reset: bool, auth_provider: &str) -> Result<()> {
5757
println!("Attempting authentication via {}...", auth_provider);
5858

59-
if auth_provider == "discord" {
60-
panic!("Discord authentication is not supported yet... WIP");
61-
}
62-
6359
let popcorn_api_url = std::env::var("POPCORN_API_URL")
6460
.map_err(|_| anyhow!("POPCORN_API_URL environment variable not set"))?;
6561

@@ -99,9 +95,12 @@ pub async fn run_auth(reset: bool, auth_provider: &str) -> Result<()> {
9995
}
10096
"github" => {
10197
let client_id = "Ov23lieFd2onYk4OnKIR";
98+
let redirect_uri =
99+
"https://discord-cluster-manager-1f6c4782e60a.herokuapp.com/auth/cli/github";
100+
let encoded_redirect_uri = urlencoding::encode(redirect_uri);
102101
format!(
103-
"https://github.com/login/oauth/authorize?client_id={}&state={}",
104-
client_id, state_b64
102+
"https://github.com/login/oauth/authorize?client_id={}&state={}&redirect_uri={}",
103+
client_id, state_b64, encoded_redirect_uri
105104
)
106105
}
107106
_ => {

0 commit comments

Comments
 (0)