mirror of
https://github.com/OAuthSwift/OAuthSwift.git
synced 2026-04-27 21:25:51 +03:00
[GH-ISSUE #472] responseType is set but not used #309
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#309
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 @yakovmanshin on GitHub (Jun 21, 2018).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/472
Description:
responseType that’s set during
OAuth2Swiftinitialization is not used.The OAuth provider I’m using returns token as
id_token. Here I set the token during initialization ofOAuth2Swift:let oauth = OAuth2Swift(consumerKey: "xxxx-xxxx-xxxx-xxxx", consumerSecret: "", authorizeUrl: "https://example.com/oauth2/authorize", accessTokenUrl: "https://example.com/oauth2/token", responseType: "id_token")OAuthSwift doesn’t recognize the token, although it can be successfully extracted using Postman or similar software.
The problem was found near line 95 in OAuth2Swift.swift:
if let accessToken = responseParameters["access_token"]Instead of using
responseTypeas dictionary key, the statement always usesaccess_tokenfor extracting the token.The correct code would be:
if let accessToken = responseParameters[this.responseType]OAuth Provider? (Twitter, Github, ..):
Private OAuth provider
OAuth Version:
Version 2
OS (Please fill the version) :
iOS 11.4
Installation method:
CocoaPods
Library version:
v1.2.0 (Swift 4.0)
Xcode version:
9.4.1 (Swift 4.1)
@yakovmanshin commented on GitHub (Jun 21, 2018):
The issue is no longer relevant.