-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from Sycrosity/spotify-auth
spotify auth
- Loading branch information
Showing
5 changed files
with
127 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use crate::prelude::*; | ||
|
||
#[derive(Debug)] | ||
pub struct AuthParams { | ||
pub response_type: &'static str, | ||
pub client_id: &'static str, | ||
pub scope: &'static str, | ||
pub code_challenge: String<64>, | ||
pub code_challenge_method: &'static str, | ||
pub redirect_uri: &'static str, | ||
} | ||
|
||
impl AuthParams { | ||
pub fn to_string(&self) -> String<256> { | ||
let mut query_string = String::new(); | ||
query_string.push_str("?").unwrap(); | ||
query_string.push_str("response_type=").unwrap(); | ||
query_string.push_str(self.response_type).unwrap(); | ||
query_string.push_str("&client_id=").unwrap(); | ||
query_string.push_str(self.client_id).unwrap(); | ||
query_string.push_str("&scope=").unwrap(); | ||
query_string.push_str(self.scope).unwrap(); | ||
query_string.push_str("&code_challenge=").unwrap(); | ||
query_string.push_str(self.code_challenge.as_str()).unwrap(); | ||
query_string.push_str("&code_challenge_method=").unwrap(); | ||
query_string.push_str(self.code_challenge_method).unwrap(); | ||
query_string.push_str("&redirect_uri=").unwrap(); | ||
query_string.push_str(self.redirect_uri).unwrap(); | ||
query_string | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters