Created
May 17, 2020 14:21
-
-
Save AlexandreCools/13e7d01eb4d774515b594f9e3df9e890 to your computer and use it in GitHub Desktop.
[MEDIUM] Strava API - Access & Refresh token - iOS 13, Swift 5 - Step 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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