public class FigoConnection extends Object
| Modifier and Type | Field and Description |
|---|---|
protected String |
apiEndpoint |
protected String |
clientId |
protected String |
clientSecret |
protected String |
redirectUri |
| Constructor and Description |
|---|
FigoConnection(String clientId,
String clientSecret,
String redirectUri)
Creates a FigoConnection instance
|
FigoConnection(String clientId,
String clientSecret,
String redirectUri,
int timeout)
Creates a FigoConnection instance
|
FigoConnection(String clientId,
String clientSecret,
String redirectUri,
int timeout,
String apiEndpoint)
Creates a FigoConnection instance
|
| Modifier and Type | Method and Description |
|---|---|
String |
addUser(String name,
String email,
String password,
String language,
boolean send_newsletter)
Create a new figo Account
|
TokenResponse |
convertAuthenticationCode(String authenticationCode)
Convert the authentication code received as result of the login process into an access token usable for data access.
|
TokenResponse |
convertRefreshToken(String refreshToken)
Convert a refresh token (granted for offline access and returned by `convert_authentication_code`) into an access token usabel for data acccess.
|
protected com.google.gson.Gson |
createGson()
Instantiate the GSON class.
|
String |
getLoginUrl(String scope,
String state)
The URL a user should open in his/her web browser to start the login process.
|
protected <T> T |
queryApi(String path,
Object data,
String method,
Type typeOfT)
Helper method for making a OAuth2-compliant API call
|
void |
revokeToken(String token)
Revoke a granted access or refresh token and thereby invalidate it.
|
protected String apiEndpoint
protected String clientId
protected String clientSecret
protected String redirectUri
public FigoConnection(String clientId, String clientSecret, String redirectUri)
clientId - the OAuth Client ID as provided by your figo developer contactclientSecret - the OAuth Client Secret as provided by your figo developer contactredirectUri - the URI the users gets redirected to after the login is finished or if he presses cancelspublic FigoConnection(String clientId, String clientSecret, String redirectUri, int timeout)
clientId - the OAuth Client ID as provided by your figo developer contactclientSecret - the OAuth Client Secret as provided by your figo developer contactredirectUri - the URI the users gets redirected to after the login is finished or if he presses cancelstimeout - the timeout used for queriespublic FigoConnection(String clientId, String clientSecret, String redirectUri, int timeout, String apiEndpoint)
clientId - the OAuth Client ID as provided by your figo developer contactclientSecret - the OAuth Client Secret as provided by your figo developer contactredirectUri - the URI the users gets redirected to after the login is finished or if he presses cancelstimeout - the timeout used for queriesapiEndpoint - which endpoint to use (customize for different figo deployment)protected <T> T queryApi(String path, Object data, String method, Type typeOfT) throws IOException, FigoException
T - Type of expected responsepath - path on the server to calldata - Payload of the requestmethod - the HTTP verb to usetypeOfT - Type of expected responseIOExceptionFigoExceptionprotected com.google.gson.Gson createGson()
public String getLoginUrl(String scope, String state)
scope - Scope of data access to ask the user for, e.g. `accounts=ro`state - String passed on through the complete login process and to the redirect target at the end. It should be used to validated the authenticity of
the call to the redirect URLpublic TokenResponse convertAuthenticationCode(String authenticationCode) throws FigoException, IOException
authenticationCode - the code received as part of the call to the redirect URL at the end of the logon processFigoExceptionIOExceptionpublic TokenResponse convertRefreshToken(String refreshToken) throws IOException, FigoException
refreshToken - refresh token returned by `convert_authentication_code`IOExceptionFigoExceptionpublic void revokeToken(String token) throws IOException, FigoException
token - access or refresh token to be revokedIOExceptionFigoExceptionpublic String addUser(String name, String email, String password, String language, boolean send_newsletter) throws IOException, FigoException
name - First and last nameemail - Email address; It must obey the figo username and password policypassword - New figo Account password; It must obey the figo username and password policylanguage - Two-letter code of preferred languagesend_newsletter - whether the user has agreed to be contacted by emailIOExceptionFigoExceptionCopyright © 2014 figo GmbH. All rights reserved.