My code:
URL url=new URL(https url with client id and clientsecret);
HttpURLConnection connect=(HttpURLConnection) url.openConnection();
connect.setRequestMethod("POST");
connect.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
connect.setDoOutput(true);
By this i'm getting
javax.net.ssl.SSLHandshakeException: Could not verify SSL certificate for URL:(my url)
And if trying to change to HttpsURLConnection
:
URL url=new URL(https url with client id and clientsecret);
HttpsURLConnection connect=(HttpsURLConnection) url.openConnection();
connect.setRequestMethod("POST");
connect.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
connect.setDoOutput(true);
i'm getting
java.lang.ClassCastException: com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection cannot be cast to javax.net.ssl.HttpsURLConnection
i'm working with GAE. I need to solve this to get the access token. I didn't got the correct solution by seeing the older questions.
when m trying through terminal via "curl" i'm able to get the valid access token.
curl --data "parameters like client id and client secret and the auth_code" my https url
after this m able to get the valid response for token