我做了一个函数来知道一个人是否连接到API。创建新令牌后 我想知道令牌是否有效。我有点被困在这里。你如何进行虚拟调用并检查令牌的有效性?
private bool IsConnectedToFitbit()
{
var access = StaminaFacade.GetBenefiaryAccess(this.Contact.EmployeeId, ProviderCode.Fitbit);
if (string.IsNullOrEmpty(access.AuthorizationKey1) || string.IsNullOrEmpty(access.AuthorizationKey2))
return false;
else
{
var tokens = new OAuthTokens
{
ConsumerKey = PortalSettings.FitbitAppId,
ConsumerSecret = PortalSettings.FitbitAppSecret,
AccessToken = access.AuthorizationKey1,
AccessTokenSecret = access.AuthorizationKey2
};
//TODO: make a dummy call to fitbit to check if tokens are valid
return true;