Skip to content

Instantly share code, notes, and snippets.

@AlexandreCools
Created May 17, 2020 14:21
Show Gist options
  • Select an option

  • Save AlexandreCools/13e7d01eb4d774515b594f9e3df9e890 to your computer and use it in GitHub Desktop.

Select an option

Save AlexandreCools/13e7d01eb4d774515b594f9e3df9e890 to your computer and use it in GitHub Desktop.
[MEDIUM] Strava API - Access & Refresh token - iOS 13, Swift 5 - Step 5
private func presentStravaAuthentication() {
let url: String = "https://www.strava.com/oauth/mobile/authorize?client_id=\(clientId)&redirect_uri=\(urlScheme)%3A%2F%2F\(fallbackUrl)&response_type=code&approval_prompt=auto&scope=read"
guard let authenticationUrl = URL(string: url) else { return }
authSession = ASWebAuthenticationSession(url: authenticationUrl, callbackURLScheme: "\(urlScheme)://") { [weak self] url, error in
if let error = error {
print(error)
} else {
if let code = self?.getCode(from: url) {
print(code)
}
}
}
authSession?.presentationContextProvider = self
authSession?.start()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment