Skip to content

Commit e0168c7

Browse files
committed
Added character escape for arguments in url
1 parent b7f6278 commit e0168c7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/StravaSwift/Router.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ extension Router: URLRequestConvertible {
399399
static var appAuthorizationUrl: URL {
400400
let baseUrl = "strava://oauth/mobile/authorize"
401401
let authParams = StravaClient.sharedInstance.authParams
402-
.map { "\($0.key)=\($0.value)" }
402+
.map { "\($0.key)=\("\($0.value)".addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!)" }
403403
.joined(separator:"&")
404404
return URL(string: "\(baseUrl)?\(authParams)")!
405405
}
@@ -410,7 +410,7 @@ extension Router: URLRequestConvertible {
410410
static var webAuthorizationUrl: URL {
411411
let baseUrl = "https://www.strava.com/oauth/authorize"
412412
let authParams = StravaClient.sharedInstance.authParams
413-
.map { "\($0.key)=\($0.value)" }
413+
.map { "\($0.key)=\("\($0.value)".addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!)" }
414414
.joined(separator:"&")
415415
return URL(string: "\(baseUrl)?\(authParams)")!
416416
}

Sources/StravaSwift/StravaClient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ extension StravaClient: ASWebAuthenticationPresentationContextProviding {
104104
} else {
105105
if #available(iOS 12.0, *) {
106106
let webAuthenticationSession = ASWebAuthenticationSession(url: Router.webAuthorizationUrl,
107-
callbackURLScheme: config?.redirectUri,
107+
callbackURLScheme: config?.redirectUri.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!,
108108
completionHandler: { (url, error) in
109109
if let url = url, error == nil {
110110
self.handleAuthorizationRedirect(url, result: result)

0 commit comments

Comments
 (0)