mirror of
https://github.com/OMGeeky/yup-oauth2.git
synced 2026-01-06 19:29:39 +01:00
Remove code to strip trailing newlines for backwards compatibility.
Based on the comment in the code the justification for the change was because old FlowDelegates used to contain newlines and changing how the returned string from the delegate was handled would be a breaking change. In this case it should be safe to remove the hack because we're breaking compatibility. All users that once implemented FlowDelegate will now need to implement InstalledFlowDelegate and uphold the new contract which implicitly means the authcode returned should represent the authcode and nothing more. No manipulation of the returned string will be done.
This commit is contained in:
@@ -127,16 +127,11 @@ impl InstalledFlow {
|
||||
scopes,
|
||||
self.flow_delegate.redirect_uri(),
|
||||
);
|
||||
let mut authcode = self
|
||||
let authcode = self
|
||||
.flow_delegate
|
||||
.present_user_url(&url, true /* need code */)
|
||||
.await
|
||||
.map_err(Error::UserError)?;
|
||||
// Partial backwards compatibility in case an implementation adds a new line
|
||||
// due to previous behaviour.
|
||||
if authcode.ends_with('\n') {
|
||||
authcode.pop();
|
||||
}
|
||||
self.exchange_auth_code(&authcode, hyper_client, app_secret, None)
|
||||
.await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user