[GH-ISSUE #86] Tuple error using authorizeWithCallbackURL #54

Closed
opened 2026-03-03 16:45:14 +03:00 by kerem · 4 comments
Owner

Originally created by @sephethus on GitHub (Aug 2, 2015).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/86

I can't get this method to compile. I get an error saying:

Tuple types '(credential: OAuthSwiftCredential, response: NSURLResponse?, parameters: NSDictionary)' and '(,)' have a different number of elements (3 vs. 2)

What am I doing wrong here?

let params = [String: String]()
let url = NSURL(string: REDIRECT_URI)
let oauthUber = OAuth2Swift(consumerKey: CLIENT_KEY, consumerSecret: CLIENT_SECRET, authorizeUrl: REGISTER_URL, responseType: "code")

oauthUber.authorizeWithCallbackURL(url!, scope: "profile history", state: "", params: params, success: {
        credentials, response in
            println("Success")
            println(credentials.oauth_token) },

        failure: { (error: NSError) -> Void in
            println("Fail")
 })

Originally created by @sephethus on GitHub (Aug 2, 2015). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/86 I can't get this method to compile. I get an error saying: Tuple types '(credential: OAuthSwiftCredential, response: NSURLResponse?, parameters: NSDictionary)' and '(_,_)' have a different number of elements (3 vs. 2) What am I doing wrong here? ``` let params = [String: String]() let url = NSURL(string: REDIRECT_URI) let oauthUber = OAuth2Swift(consumerKey: CLIENT_KEY, consumerSecret: CLIENT_SECRET, authorizeUrl: REGISTER_URL, responseType: "code") oauthUber.authorizeWithCallbackURL(url!, scope: "profile history", state: "", params: params, success: { credentials, response in println("Success") println(credentials.oauth_token) }, failure: { (error: NSError) -> Void in println("Fail") }) ```
kerem closed this issue 2026-03-03 16:45:14 +03:00
Author
Owner

@sephethus commented on GitHub (Aug 2, 2015):

Nevermind, I realized I left out parameters in the success closure. On to the next issue....

I should have put:

credentials, parameters, response in
...
<!-- gh-comment-id:127042793 --> @sephethus commented on GitHub (Aug 2, 2015): Nevermind, I realized I left out parameters in the success closure. On to the next issue.... I should have put: ``` credentials, parameters, response in ... ```
Author
Owner

@phimage commented on GitHub (Aug 2, 2015):

Please close
Check if parameters must be the last after response

<!-- gh-comment-id:127048693 --> @phimage commented on GitHub (Aug 2, 2015): Please close Check if parameters must be the last after response
Author
Owner

@sephethus commented on GitHub (Aug 2, 2015):

Neither order it's in seems to make it launch any URL in Safari...

<!-- gh-comment-id:127051408 --> @sephethus commented on GitHub (Aug 2, 2015): Neither order it's in seems to make it launch any URL in Safari...
Author
Owner

@phimage commented on GitHub (Aug 2, 2015):

You create an issue for that, please close this one about the tuple...

<!-- gh-comment-id:127051503 --> @phimage commented on GitHub (Aug 2, 2015): You create an issue for that, please close this one about the tuple...
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#54
No description provided.