Android SoundClound Java Wrapper API
I am trying to build an android app for android which using java wrapper API. My idea is that my android app can receive the verification code via a callback URL after user visits authorizationUrl and allows access to the app. For now, I am successfully redirect the user to my callback URL as blahblah.hero开发者_如何学运维ku.com and "PRINT" the verification code using oauth_verifier params. Something like this:
http://stormy-stream-176.heroku.com/?oauth_verifier=567890
Next I supposed to proceed as:
api.obtainAccessToken(VERIFICATION_CODE);
But I haven't thought of any way to pass the verification code on the android browser into the obtainAccessToken method. Any suggestion?
Well I found the solution myself by consulting Java wrapper for SoundCloud API owner. Instead of using browser for user authentication process, it's a lot easier to use username/password authentication like so:
SoundCloudAPI api = new SoundCloudAPI(consumerKey, consumerSecret, SoundCloudAPI.USE_PRODUCTION.with(OAuthVersion.V2_0));
api.obtainAccessToken("username", "`password");
This will do the trick :)
精彩评论