Search in sources :

Example 1 with AccessToken

use of fi.otavanopisto.muikku.session.AccessToken in project muikku by otavanopisto.

the class GoogleCalendarClient method getAccessTokenCredential.

@SuppressWarnings("unused")
private GoogleCredential getAccessTokenCredential() {
    AccessToken googleAccessToken = sessionController.getOAuthAccessToken("google");
    if (googleAccessToken != null) {
        Details details = new Details();
        details.setClientId("-");
        details.setClientSecret("-");
        GoogleClientSecrets secrets = new GoogleClientSecrets();
        secrets.setWeb(details);
        return new GoogleCredential.Builder().setClientSecrets(secrets).setTransport(TRANSPORT).setJsonFactory(JSON_FACTORY).build().setAccessToken(googleAccessToken.getToken());
    }
    return null;
}
Also used : Details(com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.Details) AccessToken(fi.otavanopisto.muikku.session.AccessToken) GoogleClientSecrets(com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets) GoogleCredential(com.google.api.client.googleapis.auth.oauth2.GoogleCredential)

Aggregations

GoogleClientSecrets (com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets)1 Details (com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.Details)1 GoogleCredential (com.google.api.client.googleapis.auth.oauth2.GoogleCredential)1 AccessToken (fi.otavanopisto.muikku.session.AccessToken)1