I am trying to call dropbox's API's through a java based client (spring security) but I get a 403 (Forbidden) error when I do that. The error is
WARNING: POST request for "https://www.dropbox.com/1/oauth2/authorize" resulted in 403 (Forbidden); invoking error handler
Exception in thread "main" error="access_denied", error_description="Error requesting access token."
My code looks like
private String authorizeWithImplicitFlow() {
ImplicitResourceDetails details = new ImplicitResourceDetails();
details.setPreEstablishedRedirectUri("https://www.irctc.co.in");
details.setAccessTokenUri("https://www.dropbox.com/1/oauth2/authorize");
HashMap<String, String[]> parameters = new HashMap<String, String[]>();
parameters.put("response_type", new String[] {"token"});
parameters.put("client_id", new String[]{CLIENT_ID});
OAuth2RestTemplate template = new OAuth2RestTemplate(details, new DefaultOAuth2ClientContext(new DefaultAccessTokenRequest(parameters)));
OAuth2AccessToken token = template.getAccessToken();
return token.getValue();
}
What could be reason for the 403 error? Note that I was able to successfully access the API through REST client (POSTMAN)