[GH-ISSUE #566] The operation couldn’t be completed. (OAuthSwiftError error -11.) #370

Closed
opened 2026-03-03 16:48:08 +03:00 by kerem · 5 comments
Owner

Originally created by @dipendrapulse on GitHub (Dec 17, 2019).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/566

Description:

OAuth Provider? (Basecamp3):

OAuth Version:

  • Version 1
  • Version 2

OS (Please fill the version) :

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

Installation method:

  • Carthage
  • [ x] CocoaPods
  • Swift Package Manager
  • Manually

Library version:

  • head
  • v2.1.0
  • [x ] v2.0.0
  • v1.4.1
  • v1.2 (Swift 4.0)
  • other: (Please fill in the version you are using.)

Xcode version:

  • 11.x (Swift 5.1)

  • [ x] 10.x (Swift 5.0)

  • 10.x (Swift 4.1)

  • 9.3 (Swift 4.1)

  • 9.0 (Swift 4.0)

  • other: (Please fill in the version you are using.)

  • objective c

I am trying to integrate basecamp3 but getting the error.

       func createAuthRequest(){
    // create an instance and retain it
    oauthswift = OAuth2Swift(
        consumerKey:    clientID,
        consumerSecret: clientSecret,
        authorizeUrl:   authURL,
        accessTokenUrl: tokenURL,
        responseType:   "token"
        
    )
    
      oauthswift.authorizeURLHandler = internalWebViewController
    //oauthswift.authorizeURLHandler = SafariURLHandler(viewController: self, oauthSwift: oauthswift)
    
    let handle = oauthswift.authorize(
        withCallbackURL: URL(string: redirectURL)!,
        scope: "profile", state:"hjejklk") { result in
            switch result {
            case .success(let (credential, response, parameters)):
                print(credential.oauthToken)
            // Do your request
            case .failure(let error):
                print(error.localizedDescription)
            }
    }
}
Originally created by @dipendrapulse on GitHub (Dec 17, 2019). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/566 ### Description: ### OAuth Provider? (Basecamp3): ### OAuth Version: - [ ] Version 1 - [ ] Version 2 ### OS (Please fill the version) : - [x] iOS : - [ ] OSX : - [ ] TVOS : - [ ] WatchOS : ### Installation method: - [ ] Carthage - [ x] CocoaPods - [ ] Swift Package Manager - [ ] Manually ### Library version: - [ ] head - [ ] v2.1.0 - [x ] v2.0.0 - [ ] v1.4.1 - [ ] v1.2 (Swift 4.0) - [ ] other: (Please fill in the version you are using.) ### Xcode version: - [ ] 11.x (Swift 5.1) - [ x] 10.x (Swift 5.0) - [ ] 10.x (Swift 4.1) - [ ] 9.3 (Swift 4.1) - [ ] 9.0 (Swift 4.0) - [ ] other: (Please fill in the version you are using.) - [ ] objective c I am trying to integrate basecamp3 but getting the error. func createAuthRequest(){ // create an instance and retain it oauthswift = OAuth2Swift( consumerKey: clientID, consumerSecret: clientSecret, authorizeUrl: authURL, accessTokenUrl: tokenURL, responseType: "token" ) oauthswift.authorizeURLHandler = internalWebViewController //oauthswift.authorizeURLHandler = SafariURLHandler(viewController: self, oauthSwift: oauthswift) let handle = oauthswift.authorize( withCallbackURL: URL(string: redirectURL)!, scope: "profile", state:"hjejklk") { result in switch result { case .success(let (credential, response, parameters)): print(credential.oauthToken) // Do your request case .failure(let error): print(error.localizedDescription) } } }
kerem closed this issue 2026-03-03 16:48:08 +03:00
Author
Owner

@phimage commented on GitHub (Dec 17, 2019):

https://github.com/OAuthSwift/OAuthSwift/blob/master/Sources/OAuthSwiftError.swift#L59

use debuger and see in error not only the localizedDescription but the cause error, an URLError I think and you will now

<!-- gh-comment-id:566585877 --> @phimage commented on GitHub (Dec 17, 2019): https://github.com/OAuthSwift/OAuthSwift/blob/master/Sources/OAuthSwiftError.swift#L59 use debuger and see in error not only the localizedDescription but the cause error, an URLError I think and you will now
Author
Owner

@dipendrapulse commented on GitHub (Dec 17, 2019):

It shows request error but i am not able to understand this. Please correct me if I am doing something wrong
When i print the 'result' then it shows
expression produced error: error: /var/folders/lz/8g6p_v417qvf4419d1ktm3mm0000gn/T/expr33-88f131..swift:1:89: error: 'OAuthSwift' is not a member type of 'OAuthSwift'

<!-- gh-comment-id:566595026 --> @dipendrapulse commented on GitHub (Dec 17, 2019): It shows request error but i am not able to understand this. Please correct me if I am doing something wrong When i print the 'result' then it shows expression produced error: error: /var/folders/lz/8g6p_v417qvf4419d1ktm3mm0000gn/T/expr33-88f131..swift:1:89: error: 'OAuthSwift' is not a member type of 'OAuthSwift'
Author
Owner

@phimage commented on GitHub (Dec 18, 2019):

print? it is not debugger like I say...
or "switch" on the error enum

<!-- gh-comment-id:567092628 --> @phimage commented on GitHub (Dec 18, 2019): print? it is not debugger like I say... or "switch" on the error enum
Author
Owner

@dipendrapulse commented on GitHub (Dec 18, 2019):

I think you are asking this

Result<(credential: OAuthSwiftCredential, response: Optional, parameters: Dictionary<String, Any>), OAuthSwiftError>
▿ failure : requestError[Error Domain=OAuthSwiftError Code=400 "Unsupported type. Expected "web_server" or "refresh"." UserInfo={NSLocalizedDescription=Unsupported type. Expected "web_server" or "refresh"., Response-Body={"error":"Unsupported type. Expected "web_server" or "refresh"."}, Response-Headers={
"Cache-Control" = "no-cache";
Connection = "keep-alive";
"Content-Type" = "application/json; charset=utf-8";
Date = "Wed, 18 Dec 2019 16:34:22 GMT";
"Referrer-Policy" = "strict-origin-when-cross-origin";
Server = openresty;
Status = "400 Bad Request";
"Strict-Transport-Security" = "max-age=31536000; includeSubDomains; preload";
"Transfer-Encoding" = Identity;
"X-Content-Type-Options" = nosniff;
"X-Download-Options" = noopen;
"X-Frame-Options" = SAMEORIGIN;
"X-Permitted-Cross-Domain-Policies" = none;
"X-Request-Id" = "fc071da0-319e-472a-aaaf-3ca90f909e63";
"X-Robots-Tag" = noindex;
"X-Runtime" = "0.002775";
"X-XSS-Protection" = "1; mode=block";
}, OAuthSwiftError.response=<NSHTTPURLResponse: 0x283860340> { URL: https://launchpad.37signals.com/authorization/token } { Status Code: 400, Headers {
"Cache-Control" = (
"no-cache"
);
Connection = (
"keep-alive"
);
"Content-Type" = (
"application/json; charset=utf-8"
);
Date = (
"Wed, 18 Dec 2019 16:34:22 GMT"
);
"Referrer-Policy" = (
"strict-origin-when-cross-origin"
);
Server = (
openresty
);
Status = (
"400 Bad Request"
);
"Strict-Transport-Security" = (
"max-age=31536000; includeSubDomains; preload"
);
"Transfer-Encoding" = (
Identity
);
"X-Content-Type-Options" = (
nosniff
);
"X-Download-Options" = (
noopen
);
"X-Frame-Options" = (
SAMEORIGIN
);
"X-Permitted-Cross-Domain-Policies" = (
none
);
"X-Request-Id" = (
"fc071da0-319e-472a-aaaf-3ca90f909e63"
);
"X-Robots-Tag" = (
noindex
);
"X-Runtime" = (
"0.002775"
);
"X-XSS-Protection" = (
"1; mode=block"
);
} }, OAuthSwiftError.response.data=<7b226572 726f7222 3a22556e 73757070 6f727465 64207479 70652e20 45787065 63746564 205c2277 65625f73 65727665 725c2220 6f72205c 22726566 72657368 5c222e22 7d>, NSErrorFailingURLKey=https://launchpad.37signals.com/authorization/token}]
▿ requestError : 2 elements
- error : Error Domain=OAuthSwiftError Code=400 "Unsupported type. Expected "web_server" or "refresh"." UserInfo={NSLocalizedDescription=Unsupported type. Expected "web_server" or "refresh"., Response-Body={"error":"Unsupported type. Expected "web_server" or "refresh"."}, Response-Headers={
"Cache-Control" = "no-cache";
Connection = "keep-alive";
"Content-Type" = "application/json; charset=utf-8";
Date = "Wed, 18 Dec 2019 16:34:22 GMT";
"Referrer-Policy" = "strict-origin-when-cross-origin";
Server = openresty;
Status = "400 Bad Request";
"Strict-Transport-Security" = "max-age=31536000; includeSubDomains; preload";
"Transfer-Encoding" = Identity;
"X-Content-Type-Options" = nosniff;
"X-Download-Options" = noopen;
"X-Frame-Options" = SAMEORIGIN;
"X-Permitted-Cross-Domain-Policies" = none;
"X-Request-Id" = "fc071da0-319e-472a-aaaf-3ca90f909e63";
"X-Robots-Tag" = noindex;
"X-Runtime" = "0.002775";
"X-XSS-Protection" = "1; mode=block";
}, OAuthSwiftError.response=<NSHTTPURLResponse: 0x283860340> { URL: https://launchpad.37signals.com/authorization/token } { Status Code: 400, Headers {
"Cache-Control" = (
"no-cache"
);
Connection = (
"keep-alive"
);
"Content-Type" = (
"application/json; charset=utf-8"
);
Date = (
"Wed, 18 Dec 2019 16:34:22 GMT"
);
"Referrer-Policy" = (
"strict-origin-when-cross-origin"
);
Server = (
openresty
);
Status = (
"400 Bad Request"
);
"Strict-Transport-Security" = (
"max-age=31536000; includeSubDomains; preload"
);
"Transfer-Encoding" = (
Identity
);
"X-Content-Type-Options" = (
nosniff
);
"X-Download-Options" = (
noopen
);
"X-Frame-Options" = (
SAMEORIGIN
);
"X-Permitted-Cross-Domain-Policies" = (
none
);
"X-Request-Id" = (
"fc071da0-319e-472a-aaaf-3ca90f909e63"
);
"X-Robots-Tag" = (
noindex
);
"X-Runtime" = (
"0.002775"
);
"X-XSS-Protection" = (
"1; mode=block"
);
} }, OAuthSwiftError.response.data=<7b226572 726f7222 3a22556e 73757070 6f727465 64207479 70652e20 45787065 63746564 205c2277 65625f73 65727665 725c2220 6f72205c 22726566 72657368 5c222e22 7d>, NSErrorFailingURLKey=https://launchpad.37signals.com/authorization/token}
▿ request : https://launchpad.37signals.com/authorization/token
▿ url : Optional
▿ some : https://launchpad.37signals.com/authorization/token
- _url : https://launchpad.37signals.com/authorization/token
- cachePolicy : 0
- timeoutInterval : 60.0
- mainDocumentURL : nil
- networkServiceType : __C.NSURLRequestNetworkServiceType
- allowsCellularAccess : true
▿ httpMethod : Optional
- some : "POST"
▿ allHTTPHeaderFields : Optional<Dictionary<String, String>>
▿ some : 1 element
▿ 0 : 2 elements
- key : "Content-Type"
- value : "application/x-www-form-urlencoded; charset=utf-8"
▿ httpBody : Optional
▿ some : 255 bytes
- count : 255
▿ pointer : 0x0000000133d196e0
- pointerValue : 5164340960
- httpBodyStream : nil
- httpShouldHandleCookies : false
- httpShouldUsePipelining : false

<!-- gh-comment-id:567102007 --> @dipendrapulse commented on GitHub (Dec 18, 2019): I think you are asking this Result<(credential: OAuthSwiftCredential, response: Optional<OAuthSwiftResponse>, parameters: Dictionary<String, Any>), OAuthSwiftError> ▿ failure : requestError[Error Domain=OAuthSwiftError Code=400 "Unsupported type. Expected "web_server" or "refresh"." UserInfo={NSLocalizedDescription=Unsupported type. Expected "web_server" or "refresh"., Response-Body={"error":"Unsupported type. Expected \"web_server\" or \"refresh\"."}, Response-Headers={ "Cache-Control" = "no-cache"; Connection = "keep-alive"; "Content-Type" = "application/json; charset=utf-8"; Date = "Wed, 18 Dec 2019 16:34:22 GMT"; "Referrer-Policy" = "strict-origin-when-cross-origin"; Server = openresty; Status = "400 Bad Request"; "Strict-Transport-Security" = "max-age=31536000; includeSubDomains; preload"; "Transfer-Encoding" = Identity; "X-Content-Type-Options" = nosniff; "X-Download-Options" = noopen; "X-Frame-Options" = SAMEORIGIN; "X-Permitted-Cross-Domain-Policies" = none; "X-Request-Id" = "fc071da0-319e-472a-aaaf-3ca90f909e63"; "X-Robots-Tag" = noindex; "X-Runtime" = "0.002775"; "X-XSS-Protection" = "1; mode=block"; }, OAuthSwiftError.response=<NSHTTPURLResponse: 0x283860340> { URL: https://launchpad.37signals.com/authorization/token } { Status Code: 400, Headers { "Cache-Control" = ( "no-cache" ); Connection = ( "keep-alive" ); "Content-Type" = ( "application/json; charset=utf-8" ); Date = ( "Wed, 18 Dec 2019 16:34:22 GMT" ); "Referrer-Policy" = ( "strict-origin-when-cross-origin" ); Server = ( openresty ); Status = ( "400 Bad Request" ); "Strict-Transport-Security" = ( "max-age=31536000; includeSubDomains; preload" ); "Transfer-Encoding" = ( Identity ); "X-Content-Type-Options" = ( nosniff ); "X-Download-Options" = ( noopen ); "X-Frame-Options" = ( SAMEORIGIN ); "X-Permitted-Cross-Domain-Policies" = ( none ); "X-Request-Id" = ( "fc071da0-319e-472a-aaaf-3ca90f909e63" ); "X-Robots-Tag" = ( noindex ); "X-Runtime" = ( "0.002775" ); "X-XSS-Protection" = ( "1; mode=block" ); } }, OAuthSwiftError.response.data=<7b226572 726f7222 3a22556e 73757070 6f727465 64207479 70652e20 45787065 63746564 205c2277 65625f73 65727665 725c2220 6f72205c 22726566 72657368 5c222e22 7d>, NSErrorFailingURLKey=https://launchpad.37signals.com/authorization/token}] ▿ requestError : 2 elements - error : Error Domain=OAuthSwiftError Code=400 "Unsupported type. Expected "web_server" or "refresh"." UserInfo={NSLocalizedDescription=Unsupported type. Expected "web_server" or "refresh"., Response-Body={"error":"Unsupported type. Expected \"web_server\" or \"refresh\"."}, Response-Headers={ "Cache-Control" = "no-cache"; Connection = "keep-alive"; "Content-Type" = "application/json; charset=utf-8"; Date = "Wed, 18 Dec 2019 16:34:22 GMT"; "Referrer-Policy" = "strict-origin-when-cross-origin"; Server = openresty; Status = "400 Bad Request"; "Strict-Transport-Security" = "max-age=31536000; includeSubDomains; preload"; "Transfer-Encoding" = Identity; "X-Content-Type-Options" = nosniff; "X-Download-Options" = noopen; "X-Frame-Options" = SAMEORIGIN; "X-Permitted-Cross-Domain-Policies" = none; "X-Request-Id" = "fc071da0-319e-472a-aaaf-3ca90f909e63"; "X-Robots-Tag" = noindex; "X-Runtime" = "0.002775"; "X-XSS-Protection" = "1; mode=block"; }, OAuthSwiftError.response=<NSHTTPURLResponse: 0x283860340> { URL: https://launchpad.37signals.com/authorization/token } { Status Code: 400, Headers { "Cache-Control" = ( "no-cache" ); Connection = ( "keep-alive" ); "Content-Type" = ( "application/json; charset=utf-8" ); Date = ( "Wed, 18 Dec 2019 16:34:22 GMT" ); "Referrer-Policy" = ( "strict-origin-when-cross-origin" ); Server = ( openresty ); Status = ( "400 Bad Request" ); "Strict-Transport-Security" = ( "max-age=31536000; includeSubDomains; preload" ); "Transfer-Encoding" = ( Identity ); "X-Content-Type-Options" = ( nosniff ); "X-Download-Options" = ( noopen ); "X-Frame-Options" = ( SAMEORIGIN ); "X-Permitted-Cross-Domain-Policies" = ( none ); "X-Request-Id" = ( "fc071da0-319e-472a-aaaf-3ca90f909e63" ); "X-Robots-Tag" = ( noindex ); "X-Runtime" = ( "0.002775" ); "X-XSS-Protection" = ( "1; mode=block" ); } }, OAuthSwiftError.response.data=<7b226572 726f7222 3a22556e 73757070 6f727465 64207479 70652e20 45787065 63746564 205c2277 65625f73 65727665 725c2220 6f72205c 22726566 72657368 5c222e22 7d>, NSErrorFailingURLKey=https://launchpad.37signals.com/authorization/token} ▿ request : https://launchpad.37signals.com/authorization/token ▿ url : Optional<URL> ▿ some : https://launchpad.37signals.com/authorization/token - _url : https://launchpad.37signals.com/authorization/token - cachePolicy : 0 - timeoutInterval : 60.0 - mainDocumentURL : nil - networkServiceType : __C.NSURLRequestNetworkServiceType - allowsCellularAccess : true ▿ httpMethod : Optional<String> - some : "POST" ▿ allHTTPHeaderFields : Optional<Dictionary<String, String>> ▿ some : 1 element ▿ 0 : 2 elements - key : "Content-Type" - value : "application/x-www-form-urlencoded; charset=utf-8" ▿ httpBody : Optional<Data> ▿ some : 255 bytes - count : 255 ▿ pointer : 0x0000000133d196e0 - pointerValue : 5164340960 - httpBodyStream : nil - httpShouldHandleCookies : false - httpShouldUsePipelining : false
Author
Owner

@dipendrapulse commented on GitHub (Dec 18, 2019):

I got the error, i changed my tokenurl to "https://launchpad.37signals.com/authorization/token?type=web_server" & it seems to be working now.

<!-- gh-comment-id:567117142 --> @dipendrapulse commented on GitHub (Dec 18, 2019): I got the error, i changed my tokenurl to "https://launchpad.37signals.com/authorization/token?type=web_server" & it seems to be working now.
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#370
No description provided.