mpclarkson / StravaSwift

A Swift wrapper for the Strava API v3
MIT License
102 stars 45 forks source link

After kill the app - how can we refresh the token to avoid re-authorisation #42

Open sathishchinniah04 opened 2 years ago

sathishchinniah04 commented 2 years ago

At first time all good, after we kill the app and relaunch every-time its asking for authorisation. Is there any way to re-authorise by having the previous token ?

Tried :

public func refreshAccessToken(_ refreshToken: String, result: @escaping AuthorizationHandler) {}

But not getting the result of OAuthToken

mjunkmyjunk commented 2 years ago

This is how I'm using the refreshAccessToken

 StravaClient.sharedInstance.refreshAccessToken(sRefreshToken) { result in
          switch result {
          case .success(let token):
            let accessToken = token.accessToken
            let refreshToken = token.refreshToken

          case .failure(let error):
            debugPrint(error)
          }
        }