Open mjunkmyjunk opened 3 years ago
Encoding should be handled in the wrapper. I opened a PR resolving this issue: https://github.com/mpclarkson/StravaSwift/pull/46
First of all, thanks for StravaClient. I know its a passion project, but it has saved me a ton of time. This PR resolves the issue for me as well. Can we get it merged?
Here is a workaround solution https://stackoverflow.com/a/65092728/14414215 but this also causes issue as there are 2 diff methods of handling the redirectUri depending on if user has the strava app installed on the phone or otherwise.
The percent encoding example (SO link above) is needed if the user does not have the strava app install on the phone. Hence, StravaSwift will fallback to using ASWebAuth.
However, when using this percentEncoding solution, this would then break the authentication callback when the user has the Strava App in the phone. This would then return as "FALSE" once user has fully authenticated in the strava app and returned back to the originating app. (this then breaks the app)
My solution was to do something dumb to this line. https://github.com/mpclarkson/StravaSwift/blob/e6fcffef776e9a36ad16f207b6be954c736a6fe7/Sources/StravaSwift/StravaClient.swift#L148
Basically, replacing the occurrence of the PercentEncoding back to "://" else the comparison
(url.absoluteString.starts(with: redirectUri),)
fails.