Skip to main content
Question

Using the StravaApp for Authentication on iOS with SwiftUI


Forum|alt.badge.img

In my iOS App I implemented the authentication flow according to the Strava Documentation.

  1. Checking if the StravaApp is installed, if yes, I'm using <UIApplication.shared.open> to redirect to the StravaApp.
  2. If the StravaApp is not installed I'm using <ASWebAuthenticationSession>

Everthing works OK, except in the case when the StravaApp is used for authentication.

After the user has authorised the connection to Strava inside the StravaApp, it returns to my app but the callback to my AppDelegate never happens. So I don’t get the url with the authorization code. My App uses SwiftUI. I'm injecting the AppDelegate in in my App scene:

@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

AppDelegate implementation:

class AppDelegate: NSObject, UIApplicationDelegate {
    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
print("url returned from Strava App: (url)")
return true
    }
}

Thanks for your help

Forum|alt.badge.img+20
  • Community Manager
  • September 6, 2023

Hey there @Aendu21 - did you ever get this sorted out? Thanks! 


Forum|alt.badge.img+1
  • Hub Starter
  • September 8, 2023

Unfortunately not


Forum|alt.badge.img+1
  • Hub Starter
  • September 9, 2023

Hey @Elliott11Unfortunately not 


Forum|alt.badge.img+1
  • Hub Starter
  • October 5, 2023

Hi, have you made any progress yet? I am also building an app in SwiftUI and need the same integration.


Forum|alt.badge.img+1
  • Hub Starter
  • October 6, 2023

Hi Nils98

Unfortunately not. 

As a workaround I use the <ASWebAuthenticationSession>.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept, you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings