Comments (8)
NSURLConnection
is no more used replaced by NSURLSession
with OAuthSwiftHTTPRequest
as NSURLSessionDelegate
In the two case there is more to do than stackoverflow code, many way to valid or not (always trust (bad), user/password credential, certificate), count failure, ...
Without an example of server I can't test or develop something, so I will close
If this is necessarry(request it) a delegate parameters could be added to OAuthSwiftHTTPRequest
to let framework user custom the behaviours
NSURLSessionTaskDelegate could be used intead of NSURLSessionDelegate
Some code
https://github.com/search?l=swift&q=didReceiveChallenge+&type=Code&utf8=%E2%9C%93
https://gist.github.com/edwardmp/df8517aa9f1752e73353
func URLSession(session: NSURLSession, didReceiveChallenge challenge: NSURLAuthenticationChallenge, completionHandler: (NSURLSessionAuthChallengeDisposition, NSURLCredential!) -> Void) {
// accept
completionHandler(NSURLSessionAuthChallengeDisposition.UseCredential, NSURLCredential(forTrust: challenge.protectionSpace.serverTrust))
// or cancel
completionHandler(NSURLSessionAuthChallengeDisposition.CancelAuthenticationChallenge, nil)
from oauthswift.
Was this (or a way to set my own delegate) ever implemented?
I am using my own id provider, so in the development environment it's a created SSL cert. So this is needed.
from oauthswift.
@makeitTim
You can set your own url session delegate for all url session created by oauthswift
var sessionFactory = URLSessionFactory.default
sessionFactory.delegate = <your delegate>
And some framework methods use URLSessionFactory
as parameter, for advanced use, and use another factory.
from oauthswift.
Thanks! I just found the SessionFactory struct and have been trying to figure out how to use it.
Xcode does not like the code you gave me, default can only appear in a switch statement
. I cannot get it to run.
The convention for singleton naming in Swift seems to be shared:
public static var shared = URLSessionFactory()
from oauthswift.
I agree with naming bug with swift 3 you can use default
I edit the code, by replacing ;
by =
from oauthswift.
Thanks for the quick response... I don't follow you? What would allow swift to use a variable named default
?
from oauthswift.
This not a forbidden keyword, go to the URLSessionFactory
code and you will see
Just ass some magic quote and you can use default
from oauthswift.
Ok, I was able to access the session factory with var sessionFactory = URLSessionFactory.default
. I have not been able to get a self-signed SSL cert to work, even with implementing a URLSessionDelegate. But I think we're gonna try to get a verified certificate for dev anyways as that's a better way to work and Apple will require it in the end.
Keep up the good work!
from oauthswift.
Related Issues (20)
- does Slack api return User Token? HOT 1
- Can't allow cookies for url request
- how can I send http request with url scheme? HOT 1
- Small buttons after login on webview OAuth2
- Twitch Dev URL Scheme Issue HOT 2
- OAuthSwiftError -10 after canceling redirection to app HOT 3
- Connot Run on Linux HOT 3
- OAuthSwift authorize : States not equal in response. HOT 1
- Canceling Apple ID isn't handled
- Swift Concurrency HOT 1
- Call to /request_token after canceling a request fails with HTTP 401 because oauth_token is already set.
- Cannot redirect to the app after autosubmit credentials HOT 4
- the closure for the authorize function callback is not being executed at all. HOT 2
- url scheme no works,debug out HOT 2
- Twitter SignIn - SessionStorage Error HOT 3
- A
- visionOS Support HOT 1
- Trying to use different JSON properties in token result HOT 1
- Does not work with Zotero Oauth HOT 3
- It takes a while to show the authorization web page
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oauthswift.