Skip to content

ASWeb Auth error due to redirector encoding issueΒ #37

Open
@mjunkmyjunk

Description

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),

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions