mirror of
https://github.com/OAuthSwift/OAuthSwift.git
synced 2026-04-26 12:45:52 +03:00
[GH-ISSUE #512] How to extract HTTP status code from OAuthSwiftError? #334
Labels
No labels
bug
cocoapod
duplicate
enhancement
feature-request
help wanted
help wanted
invalid
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/OAuthSwift#334
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @abinrm on GitHub (Feb 7, 2019).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/512
Description:
How to extract HTTP status code from OAuthSwiftError?

When wrong credentials is given for login it returns 401 in Postman app
When I enter wrong credentials in my app as below, it goes to failure block and all I can get is an
OAuthSwiftError.I would like to display an alert on the wrong credentials. I prefer displaying Unauthorised / username and password doesn't match over alert saying
some error occurredThe error I get is as below, So how can I extract the HTTP status code from this error?
OAuth Provider? (Twitter, Github, ..):
Third Party
OAuth Version:
OS (Please fill the version) :
Installation method:
Library version:
Xcode version:
10.1 (Swift 4.2)
9.3 (Swift 4.1)
9.0 (Swift 4.0)
9.0 (Swift 3.2)
8.x (Swift 3.x)
8.0 (Swift 2.3)
7.3.1
other: (Please fill in the version you are using.)
objective c
@phimage commented on GitHub (Feb 21, 2019):
if you recieve an requestError
get the error with .error or with switch case
then get code in error: .error?.code
see how I construct the error from response (URLResponse)
.requestError(error: NSError(domain: NSURLErrorDomain, code: response.statusCode, userInfo: userInfo), request: request))