[GH-ISSUE #405] Getting OAuthSwiftError error -3 or -1 #257

Closed
opened 2026-03-03 16:47:08 +03:00 by kerem · 2 comments
Owner

Originally created by @SergeiKu on GitHub (Sep 2, 2017).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/405

Description:

OAuth Provider (Twitter, Github, ..):

OAuth Version:

  • Version 1
  • [x ] Version 2

OS (Please fill the version) :

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

Installation method:

  • Carthage
  • [x ] CocoaPods
  • Manually

Library version:

  • [x ] head
  • v1.0.0
  • v0.6
  • other: (Please fill in the version you are using.)

Xcode version:

  • [x ] 8.0 (Swift 3.0)

  • 8.0 (Swift 2.3)

  • 7.3.1

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

  • objective c

I am getting OAuthSwiftError error (if allowMissingStateCheck = false)-3 or (if allowMissingStateCheck = true)-1. I am trying to authorize with Microsoft oneDrive. The call back is some-uri://somthing/auth?code=xxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxx and I think it returns the auth code. I have no idea why the errors happen. Please, help.

class SomeClass {

var oauthswift: OAuth2Swift?

override func startDirectoryScan() {
    
    
    oauthswift = OAuth2Swift(
        consumerKey:    AppOneDriveID,
        consumerSecret: "",
        authorizeUrl:   "https://login.live.com/oauth20_authorize.srf",
        responseType:   "code"
    )
    self.oauthswift!.allowMissingStateCheck = false
    self.oauthswift!.authorizeURLHandler = SafariURLHandler(viewController: self, oauthSwift: self.oauthswift!)
    self.oauthswift!.authorize(withCallbackURL: URL(string: "some-uri://somthing/auth")!,
        scope:  "onedrive.readonly offline_access", state:"",
        success: { credential, response, parameters in
            print("resp \(credential, response, parameters)")
                    // Do your request
            
            },
                failure: { error in
                    print(error.localizedDescription)
            }
    )
}

}

Originally created by @SergeiKu on GitHub (Sep 2, 2017). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/405 ### Description: ### OAuth Provider (Twitter, Github, ..): ### OAuth Version: - [ ] Version 1 - [x ] Version 2 ### OS (Please fill the version) : - [x] iOS : - [ ] OSX : - [ ] TVOS : - [ ] WatchOS : ### Installation method: - [ ] Carthage - [x ] CocoaPods - [ ] Manually ### Library version: - [x ] head - [ ] v1.0.0 - [ ] v0.6 - [ ] other: (Please fill in the version you are using.) ### Xcode version: - [x ] 8.0 (Swift 3.0) - [ ] 8.0 (Swift 2.3) - [ ] 7.3.1 - [ ] other: (Please fill in the version you are using.) - [ ] objective c I am getting OAuthSwiftError error (if allowMissingStateCheck = false)-3 or (if allowMissingStateCheck = true)-1. I am trying to authorize with Microsoft oneDrive. The call back is some-uri://somthing/auth?code=xxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxx and I think it returns the auth code. I have no idea why the errors happen. Please, help. class SomeClass { var oauthswift: OAuth2Swift? override func startDirectoryScan() { oauthswift = OAuth2Swift( consumerKey: AppOneDriveID, consumerSecret: "", authorizeUrl: "https://login.live.com/oauth20_authorize.srf", responseType: "code" ) self.oauthswift!.allowMissingStateCheck = false self.oauthswift!.authorizeURLHandler = SafariURLHandler(viewController: self, oauthSwift: self.oauthswift!) self.oauthswift!.authorize(withCallbackURL: URL(string: "some-uri://somthing/auth")!, scope: "onedrive.readonly offline_access", state:"", success: { credential, response, parameters in print("resp \(credential, response, parameters)") // Do your request }, failure: { error in print(error.localizedDescription) } ) } }
kerem closed this issue 2026-03-03 16:47:08 +03:00
Author
Owner

@phimage commented on GitHub (Sep 2, 2017):

Errors code : https://github.com/OAuthSwift/OAuthSwift/blob/master/Sources/OAuthSwiftError.swift

Look at configurationError in code for -1
One cause is missing to define accessTokenUrl

<!-- gh-comment-id:326761368 --> @phimage commented on GitHub (Sep 2, 2017): Errors code : https://github.com/OAuthSwift/OAuthSwift/blob/master/Sources/OAuthSwiftError.swift Look at configurationError in code for -1 One cause is missing to define accessTokenUrl
Author
Owner

@SergeiKu commented on GitHub (Sep 3, 2017):

Thank you, yes, you are right! Closed.

<!-- gh-comment-id:326789818 --> @SergeiKu commented on GitHub (Sep 3, 2017): Thank you, yes, you are right! Closed.
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#257
No description provided.