java - Using HtmlUnit to get the access token from instagram -


since httpurlconnection didn't cut out, switched htmlunit programatically auth code access token instagram , whatever need there, thing i'm stuck trying retrieve authorization code url

mysite.com/?code=ca1ec5b06a0b409293cff74ed9876a46

but can't access link since doesn't seems redirected authorization url. one:

https://instagram.com/accounts/login/?force_classic_login=&next=/oauth/authorize/%3fclient_id%client_id%26redirect_uri%3dhttp%3a//mysite.com%26response_type%3dcode

this code try access url:

webclient webclient = new webclient(browserversion.firefox_38);     webclient.getoptions().setjavascriptenabled(true);     webclient.getoptions().setredirectenabled(true);     webclient.getoptions().setthrowexceptiononscripterror(false);     webclient.getoptions().setcssenabled(true);          htmlpage page = (htmlpage) webclient.getpage(authurl);     webresponse response = page.getwebresponse();     string content = response.getcontentasstring();     system.out.println(page.geturl()); 

i resolved trying authorization url without being logged site, when asked login, used htmlunit html form login instagram, desired redirect url code.


Comments