diff --git a/CHANGELOG.md b/CHANGELOG.md index dc6985b4..4680fc7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- [core] Add `get_token_with_client_id()` to get a token for a specific client ID - [core] Add `login` (mobile) and `auth_token` retrieval via login5 - [core] Add `OS` and `os_version` to `config.rs` - [discovery] Added a new MDNS/DNS-SD backend which connects to Avahi via D-Bus. diff --git a/core/src/token.rs b/core/src/token.rs index 946367c3..445b8aeb 100644 --- a/core/src/token.rs +++ b/core/src/token.rs @@ -58,9 +58,20 @@ impl TokenProvider { }) } + // Not all combinations of scopes and client ID are allowed. + // Depending on the client ID currently used, the function may return an error for specific scopes. + // In this case get_token_with_client_id() can be used, where an appropriate client ID can be provided. // scopes must be comma-separated pub async fn get_token(&self, scopes: &str) -> Result { let client_id = self.session().client_id(); + self.get_token_with_client_id(scopes, &client_id).await + } + + pub async fn get_token_with_client_id( + &self, + scopes: &str, + client_id: &str, + ) -> Result { if client_id.is_empty() { return Err(Error::invalid_argument("Client ID cannot be empty")); }