<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z00008FnqcBCAROkta Classic EngineSingle Sign-OnAnswered2022-10-21T23:10:24.000Z2022-10-21T11:50:20.000Z2022-10-21T23:10:24.000Z

mihirk.61757 (Customer) asked a question.

Unable to get Response body from access token call after passing all the headers and parameters.

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

 

 


  • User16594883467582706479 (Customer Support Online Experience)

    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. 

    _____________________________________________________________________________

     

    Expand Post
This question is closed.
Loading
Unable to get Response body from access token call after passing all the headers and parameters.