onedrive-api
onedrive-api copied to clipboard
Feeature request: Could we get a get_code_url_with_state option
Hi! Thanks for making this library, I was wondering if we could add a feature to be able to set the state when requesting a code_auth url. It could either be a new endpoint or the same endpoint with an optional param. If its a different endpoint however, there wouldn't be any breaking changes.
To make it clearer, I'm thinking about something along the lines of below. Would be happy to open a pull request if you want me to do this
#[must_use]
pub fn code_auth_url_with_state(&self, state: &str) -> Url {
let mut url = self.endpoint_url("authorize");
url.query_pairs_mut()
.append_pair("client_id", &self.client_id)
.append_pair("scope", &self.permission.to_scope_string())
.append_pair("redirect_uri", &self.redirect_uri)
.append_pair("response_type", "code");
.append_pair("state", state);
url
}