Can't login. Get http status 400
Opened this issue · 1 comments
tpraizler commented
Hey,
I am not sure it's a problem in the lib, but I try to login in the recent days and fail.
val httpClient: OkHttpClient =
new OkHttpClient.Builder()
.addInterceptor(new UserAgentInterceptor(UserAgents.OSX_CHROME))
.addInterceptor(new ErrorInterceptor)
.cookieJar(new DefaultCookieJar(new CookieHashSet))
.build
val client = new Instagram(httpClient)
def login(): Unit = {
client.basePage()
client.login(credentials.username, credentials.password)
client.basePage()
}
I am using the same code to do this locally and I manage to log in, but once I upload this code to my server which is not where I am located it fails.
Do you have any suggestions on how to handle this?
igor-suhorukov commented
Hi @tpraizler
Try add logging interceptor and collect more context info:
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient httpClient = new OkHttpClient.Builder()
.addNetworkInterceptor(loggingInterceptor)