Back to project page dw2020.
The source code is released under:
Apache License
If you think the Android project dw2020 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.darkwire.example.builder; /*from w w w .j a v a 2s . com*/ import net.darkwire.example.exception.AuthenticationError; import net.darkwire.example.model.FiveHundredPxConfiguration; import com.fivehundredpx.api.FiveHundredException; import com.fivehundredpx.api.auth.AccessToken; import com.fivehundredpx.api.auth.OAuthAuthorization; import com.fivehundredpx.api.auth.XAuthProvider; /** * Created by fsiu on 4/19/14. */ public class FiveHundredPxAccessToken { public static AccessToken build(final FiveHundredPxConfiguration config) throws AuthenticationError { final AccessToken result; try { final OAuthAuthorization oauth = new OAuthAuthorization.Builder() .consumerKey(config.getConsumerKey()) .consumerSecret(config.getConsumerSecret()) .build(); result = oauth.getAccessToken(new XAuthProvider(config.getUsername(), config.getPassword())); } catch (FiveHundredException fhe) { throw new AuthenticationError(fhe); } return result; } }