Skip to content

Commit

Permalink
Merge pull request #512 from gdesmott/pkce
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsayleung authored Dec 29, 2024
2 parents bd35dbc + a9c14b5 commit a12694f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

**New features**
- ([#496](https://github.com/ramsayleung/rspotify/pull/497)) Add support for searching multiple types
- ([#512](https://github.com/ramsayleung/rspotify/pull/512)) Add `AuthCodePkceSpotify::from_token_with_config()`


## 0.13.3 (2024.08.24)
Expand Down
18 changes: 18 additions & 0 deletions src/auth_code_pkce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,24 @@ impl AuthCodePkceSpotify {
}
}

/// Build a new [`AuthCodePkceSpotify`] from an already generated token and
/// config. Use this to be able to refresh a token.
#[must_use]
pub fn from_token_with_config(
token: Token,
creds: Credentials,
oauth: OAuth,
config: Config,
) -> Self {
Self {
token: Arc::new(Mutex::new(Some(token))),
creds,
oauth,
config,
..Default::default()
}
}

/// Generate the verifier code and the challenge code.
fn generate_codes(verifier_bytes: usize) -> (String, String) {
log::info!("Generating PKCE codes");
Expand Down

0 comments on commit a12694f

Please sign in to comment.