Created
March 30, 2014 14:19
-
-
Save johnhiott/9873396 to your computer and use it in GitHub Desktop.
Class to add Fitbit OAuth API to Scribe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FitbitApi extends DefaultApi10a { | |
public static final String BASE_URL = "http://api.fitbit.com/"; | |
private static final String REQUEST_TOKEN_RESOURCE = "api.fitbit.com/oauth/request_token"; | |
private static final String AUTHORIZE_URL = "https://api.fitbit.com/oauth/authorize?oauth_token=%s"; | |
private static final String ACCESS_TOKEN_RESOURCE = "api.fitbit.com/oauth/access_token"; | |
@Override | |
public String getAccessTokenEndpoint() { | |
return "https://" + ACCESS_TOKEN_RESOURCE; | |
} | |
@Override | |
public String getRequestTokenEndpoint() { | |
return "https://" + REQUEST_TOKEN_RESOURCE; | |
} | |
@Override | |
public String getAuthorizationUrl(Token requestToken) { | |
return String.format(AUTHORIZE_URL, requestToken.getToken()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment