Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASWeb Auth error due to redirector encoding issue #37

Open
mjunkmyjunk opened this issue Aug 21, 2021 · 2 comments
Open

ASWeb Auth error due to redirector encoding issue #37

mjunkmyjunk opened this issue Aug 21, 2021 · 2 comments

Comments

@mjunkmyjunk
Copy link

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.

if let redirectUri = config?.redirectUri, url.absoluteString.starts(with: redirectUri),

Basically, replacing the occurrence of the PercentEncoding back to "://" else the comparison (url.absoluteString.starts(with: redirectUri),) fails.

   if let redirectUri = config?.redirectUri.components(separatedBy: "%3A%2F%2F").joined(separator: "://"), url.absoluteString.starts(with: redirectUri),
fehguy added a commit to fehguy/StravaSwift that referenced this issue Aug 11, 2023
@loryhuz
Copy link
Contributor

loryhuz commented Oct 23, 2023

Encoding should be handled in the wrapper.
I opened a PR resolving this issue: #46

@jeffbailey
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants