Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save AlexandreCools/d15c9f5c103e7db264c121707513dafd to your computer and use it in GitHub Desktop.
[MEDIUM] Strava API - Access & Refresh token - iOS 13, Swift 5 - Step 6
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