You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.
I'm getting (java.lang.String) Cannot extract an access token. Response was: {"error_type": "OAuthException", "code": 400, "error_message": "Matching code was not found or was already used."} while accessing access token.
The piece of code I've written to get the access token:
InstagramService service = new InstagramAuthService().apiKey(this.instagramClientId) .apiSecret(this.instagramClientSecret).callback(this.instagramCallbackUrl).build(); String authorizationUrl = service.getAuthorizationUrl(); Verifier verifier = new Verifier(authorizationUrl); try { return service.getAccessToken(verifier); }catch(OAuthException authException) { authException.getMessage(); }
Here, the verifier which is passed is not the code after redirection but the complete authorization URL which I think is the reason of error mentioned at the top. In the verifier, I should be passing the authorization code which I will be getting after hitting https://api.instagram.com/oauth/authorize/?client_id=<CLIENT_ID>&redirect_uri=<CALLBACK_URL>&response_type=code but it asks for credentials which nowhere we're passing. So, I wanna know is there any piece of code written code which I can use to generate the Authorization code or I need to write separate code for that?
The text was updated successfully, but these errors were encountered:
I've got the same issue wiht the example. I try to use Java Lib but i've got the Insta page where i have to fill username/password info to get the code afterwords...
Some has resolve this point?
I didn't find resolution of that problem. So, as a workaround I generated the access token (since there's no expiry of it) and passed access token to fetch account data.
Hi,
I'm getting (java.lang.String) Cannot extract an access token. Response was: {"error_type": "OAuthException", "code": 400, "error_message": "Matching code was not found or was already used."} while accessing access token.
The piece of code I've written to get the access token:
InstagramService service = new InstagramAuthService().apiKey(this.instagramClientId) .apiSecret(this.instagramClientSecret).callback(this.instagramCallbackUrl).build(); String authorizationUrl = service.getAuthorizationUrl(); Verifier verifier = new Verifier(authorizationUrl); try { return service.getAccessToken(verifier); }catch(OAuthException authException) { authException.getMessage(); }
Here, the verifier which is passed is not the code after redirection but the complete authorization URL which I think is the reason of error mentioned at the top. In the verifier, I should be passing the authorization code which I will be getting after hitting https://api.instagram.com/oauth/authorize/?client_id=<CLIENT_ID>&redirect_uri=<CALLBACK_URL>&response_type=code but it asks for credentials which nowhere we're passing. So, I wanna know is there any piece of code written code which I can use to generate the Authorization code or I need to write separate code for that?
The text was updated successfully, but these errors were encountered: