Codota Logo
OAuthToken.<init>
Code IndexAdd Codota to your IDE (free)

How to use
org.apache.camel.component.linkedin.api.OAuthToken
constructor

Best Java code snippets using org.apache.camel.component.linkedin.api.OAuthToken.<init> (Showing top 2 results out of 315)

  • Common ways to obtain OAuthToken
private void myMethod () {
OAuthToken o =
  • Codota IconOAuthSecureStorage oAuthSecureStorage;oAuthSecureStorage.getOAuthToken()
  • Smart code suggestions by Codota
}
origin: org.apache.camel/camel-linkedin

  public DefaultOAuthSecureStorage(String accessToken, Long expiryTime) {
    super(null);
    if (expiryTime == null) {
      expiryTime = System.currentTimeMillis() + TimeUnit.MILLISECONDS.convert(60, TimeUnit.DAYS);
    }
    this.token = new OAuthToken(null, accessToken, expiryTime);
  }
}
origin: org.apache.camel/camel-linkedin-api

private OAuthToken getAccessToken(String refreshToken) throws IOException {
  final String tokenUrl = String.format(ACCESS_TOKEN_URL, refreshToken,
    oAuthParams.getRedirectUri(), oAuthParams.getClientId(), oAuthParams.getClientSecret());
  final WebRequest webRequest = new WebRequest(new URL(tokenUrl), HttpMethod.POST);
  final WebResponse webResponse = webClient.loadWebResponse(webRequest);
  if (webResponse.getStatusCode() != HttpStatus.SC_OK) {
    throw new IOException(String.format("Error getting access token: [%s: %s]",
      webResponse.getStatusCode(), webResponse.getStatusMessage()));
  }
  final long currentTime = System.currentTimeMillis();
  final ObjectMapper mapper = new ObjectMapper();
  final Map map = mapper.readValue(webResponse.getContentAsStream(), Map.class);
  final String accessToken = map.get("access_token").toString();
  final Integer expiresIn = Integer.valueOf(map.get("expires_in").toString());
  return new OAuthToken(refreshToken, accessToken,
    currentTime + TimeUnit.MILLISECONDS.convert(expiresIn, TimeUnit.SECONDS));
}
org.apache.camel.component.linkedin.apiOAuthToken<init>

Popular methods of OAuthToken

  • getExpiryTime
  • getAccessToken

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • putExtra (Intent)
  • onCreateOptionsMenu (Activity)
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
  • BoxLayout (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Join (org.hibernate.mapping)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now