Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change URLRequest's timeoutInterval #667

Open
5 of 20 tasks
MikeSpelling opened this issue Jul 5, 2021 · 1 comment
Open
5 of 20 tasks

Cannot change URLRequest's timeoutInterval #667

MikeSpelling opened this issue Jul 5, 2021 · 1 comment

Comments

@MikeSpelling
Copy link

MikeSpelling commented Jul 5, 2021

Description:

Using OAuth2Swift startAuthorizedRequest there is no way to override the requestTimeout. Although we can override the sessions timeout via:

let configuration = oauthswift.client.sessionFactory.configuration
configuration.timeoutIntervalForRequest = 300
oauth.client.sessionFactory.configuration = configuration

This will be overridden by the actual URLRequest's timeoutInterval used as, from Apple, https://developer.apple.com/documentation/foundation/urlsessionconfiguration:

In some cases, the policies defined in this configuration may be overridden by policies specified by an NSURLRequest object provided for a task. Any policy specified on the request object is respected unless the session’s policy is more restrictive.

In this case the OAuthSwiftHTTPRequest instantiates it's Config object which has a default timeoutInterval set to 60.
Changing the URLSession's configuration's timeoutIntervalForRequest does not seem to be able to override this.

OAuth Provider? (Twitter, Github, ..):

Custom - using our own Identity Server

OAuth Version:

  • Version 1
  • Version 2

OS (Please fill the version) :

  • iOS :
  • OSX :
  • TVOS :
  • WatchOS :

Installation method:

  • Carthage
  • CocoaPods
  • Swift Package Manager
  • Manually

Library version:

  • head
  • v2.1.0
  • v2.0.0
  • v1.4.1
  • other: (v2.2.0)

Xcode version:

  • 11.4 (Swift 5.2)
  • 11.x (Swift 5.1)
  • 10.x (Swift 5.0)
  • other: (Xcode 12.5.1, Swift 5.4)
  • objective c
@MikeSpelling
Copy link
Author

Any update on this? I couldn't find a solution so I've created a PR at /pull/672 which solves it for me...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant