
mihirk.61757 (Customer) asked a question.
Hi All,
We are using below code to make access token call but getting blank Response body. Kindly suggest.
HttpClient httpClient = new HttpClient();
String endpoint = "https://dev-15411581.okta.com/oauth2/default/v1/token";
String uri = "";
if (!endpoint.endsWith("/")){
endpoint = endpoint + '/';
}
uri = endpoint;
PostMethod postmethod = new PostMethod(uri);
HttpMethod method = new GetMethod(uri);
try {
//String code =request.getParameter("code");
Header header = new Header("content", "application/x-www-form-urlencoded");
method.setRequestHeader(header);
ChannelLogger.logDebug(this, "Adding Transfer token request header " + header);
postmethod.addParameter("grant_type", "authorization_code");
postmethod.addParameter("code",code);
postmethod.addParameter("redirect_uri", "http://192.168.1.9:8080/Hello");
postmethod.addParameter("client_id", "0oa60ln2uiYjJWHBM5d7");
postmethod.addParameter("client_secret","0oa60ln2uiYjJWHBM5d7");
postmethod.addParameter("code_verifier",codeVerifier);
Regards,
Mihir

Hi, @mihirk.61757 (Customer)
Thank you for posting on our Community page!
My advice would be to leverage the Okta Developer forums for this type of questions and take advantage of their expertise.
https://devforum.okta.com/
Thank you for reaching out to our Community and have a great day!
_____________________________________________________________________________
The October issue of the Okta Community is here and packed with tips on certification, how to earn badges, and new releases. Let us help you stay connected.
_____________________________________________________________________________
If my answer helped, remember to select it as best to increase its visibility for other members of the Okta Community who might have the same questions as you.
_____________________________________________________________________________