Closed bleeckerj closed 6 years ago
Read the Readme, it is documented there.
On 20 Apr 2018, at 21:27, Julian Bleecker notifications@github.com wrote:
Do you have any concrete examples of using the Authentication API? The Test code isn't entirely clear to me how you handle the result and extract the token.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Indeed, and I've made some progress, but continue to get errors indicating I should refresh my Token and no real indication as to how to do that, or examples of semantic error handling.
There is also an app folder in this repo with an example on how to authenticate and extract the token.
I honestly appreciate the comments and pointers — I do not see an app folder in the repo. All I see are the extensive source code and the StravaZpotTests. Can you point where you mean?
I'm sorry, I got confused with the Android repo, which has a sample app folder.
I'm not sure what's the issue you are having, the README is quite descriptive about how to proceed. I guess you have created an AuthenticationViewController
as described here. Then you need to create your delegate implementing this method:
func authenticationViewController(_ authenticationViewController: AuthenticationViewController, didFinishWithCode code: String) {
// Use code to obtain token
}
The implementation inside this method should be according what is explained here. In order to check if the result was successful or not, you can do something like:
func processLogin(result : StravaResult<LoginResult>) {
switch result {
case let .success(login): ... // Save the token in the LoginResult
case let .error(cause): ... // Process the error
}
}
I insist, all this is described in the README. Beyond this, it is up to your app how to proceed with saving the token and using it.
Do you have any concrete examples of using the Authentication API? The Test code isn't entirely clear to me how you handle the result and extract the token.