Wahoo fitness service

Recommend this page to a friend!

      PHP OAuth Library  >  All threads  >  Wahoo fitness service  >  (Un) Subscribe thread alerts  
Subject:Wahoo fitness service
Summary:Issue with refresh
Messages:2
Author:Tomate
Date:2021-05-25 14:11:55
 

  1. Wahoo fitness service   Reply   Report abuse  
Picture of Tomate Tomate - 2021-05-25 14:11:55
Hello,

I'm in the process of implementing Wahoo fitness API witch works with oAuth 2.0.
I successfully retrieve the access token and the access token works but its lifetime is very limited.
Currently it seams to be two hours.
They provide a refresh URI that use the refresh token to retrieve a new access token.
The process seams to be automated in your library and check the expiry date to automatically retrieve a new access token in CallAPI method.

The Wahoo fitness documentation is here if you want to take a look:
cloud-api.wahooligan.com/

With that said, my issue is the fact that I don't use your CallAPI method to do my API calls. Is there some method in you're library to only do the refresh token call?
It seams to be this method call that should do it:
$client->ProcessToken2(null, true);
But I don't know if this method could be call directly (no private / public are presents on method definitions)
If it's callable directly after initializing a new database_oauth_client_class object what attribute should be define?

One other way should be to use the CallAPI method but I have implemented a database_oauth_client_class and don't currently have a method in this object to "re-use" a previous item. The way I've done it is that I use the data in DB to do API call directly with curl.
I try to restore the state of a previous database_oauth_client_class instance to not do the whole process again, but can't find what attribute / method to override.

I've use this object for other providers that have far longer expiry duration and that's why I never encounter this issue.

An other slightly off topics question, when I do the oAuth login process the object contains an "expiry" attribute and a "access_token_expiry" those two attributes contains the same date, is this really the same and the "$oauth_session->expiry" is in fact the "access_token_expiry" or could those dates could have different values?

Thanks for your help,

Cordially,

  2. Re: Wahoo fitness service   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2021-05-29 13:20:47 - In reply to message 1 from Tomate
Hello Tomate,

The best solution is to use the CallAPI function to renew the expired tokens for you transparently.

The database_oauth_client_class will also load the previous state for the current user. You need to set the $user variable of the oAuth client object of the database_oauth_client_class to recover the previous state from the database.

 
For more information send a message to info at phpclasses dot org.