[GH-ISSUE #629] OAuth provider returns 403 instead of 401 for expired token #410

Closed
opened 2026-03-03 16:48:27 +03:00 by kerem · 1 comment
Owner

Originally created by @fmoraes74 on GitHub (Oct 21, 2020).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/629

Description:

The HSReplay OAuth provider is returning 403 instead of 401 for an expired token. This means that automatic token renewal is not working as the code only checks for 401 and 400 errors in the NSError extension. Is there a way to work around it without having to explicitly try to refresh the token in case of an unexpected error?

OAuth Provider? (Twitter, Github, ..):

HSReplay.net

OAuth Version:

  • Version 1
  • Version 2

OS (Please fill the version) :

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

Installation method:

  • Carthage
  • CocoaPods
  • Swift Package Manager
  • Manually

Library version:

  • head
  • v2.1.0
  • v2.0.0
  • v1.4.1
  • other: (Please fill in the version you are using.)

Xcode version:

  • 11.4 (Swift 5.2)

  • 11.x (Swift 5.1)

  • 10.x (Swift 5.0)

  • other: 12.1

  • objective c

Originally created by @fmoraes74 on GitHub (Oct 21, 2020). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/629 ### Description: The HSReplay OAuth provider is returning 403 instead of 401 for an expired token. This means that automatic token renewal is not working as the code only checks for 401 and 400 errors in the NSError extension. Is there a way to work around it without having to explicitly try to refresh the token in case of an unexpected error? ### OAuth Provider? (Twitter, Github, ..): HSReplay.net ### OAuth Version: - [ ] Version 1 - [x] Version 2 ### OS (Please fill the version) : - [ ] iOS : - [x] OSX : 10.15.7 - [ ] TVOS : - [ ] WatchOS : ### Installation method: - [x] Carthage - [ ] CocoaPods - [ ] Swift Package Manager - [ ] Manually ### Library version: - [ ] head - [ ] v2.1.0 - [ ] v2.0.0 - [x] v1.4.1 - [ ] other: (Please fill in the version you are using.) ### Xcode version: - [ ] 11.4 (Swift 5.2) - [ ] 11.x (Swift 5.1) - [ ] 10.x (Swift 5.0) - [x] other: 12.1 - [ ] objective c
kerem closed this issue 2026-03-03 16:48:28 +03:00
Author
Owner

@phimage commented on GitHub (Nov 10, 2020):

add a new case in code (PR)
https://github.com/OAuthSwift/OAuthSwift/blob/master/Sources/NSError%2BOAuthSwift.swift#L70

<!-- gh-comment-id:724438428 --> @phimage commented on GitHub (Nov 10, 2020): add a new case in code (PR) https://github.com/OAuthSwift/OAuthSwift/blob/master/Sources/NSError%2BOAuthSwift.swift#L70
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#410
No description provided.