Created
May 17, 2020 14:22
-
-
Save AlexandreCools/d15c9f5c103e7db264c121707513dafd to your computer and use it in GitHub Desktop.
[MEDIUM] Strava API - Access & Refresh token - iOS 13, Swift 5 - Step 6
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 let clientSecret: String = "yourClientSecret" | |
| private func requestStravaTokens(with code: String) { | |
| let parameters: [String: Any] = ["client_id": clientId, "client_secret": clientSecret, "code": code, "grant_type": "authorization_code"] | |
| AF.request("https://www.strava.com/oauth/token", method: .post, parameters: parameters).response { response in | |
| guard let data = response.data else { return } | |
| if let json = try? JSONSerialization.jsonObject(with: data, options: []) { | |
| print(json) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment