Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7668705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:25:39+00:00 2026-05-31T15:25:39+00:00

I am able to get the access_token for the salesforce oath2. access token can

  • 0

I am able to get the access_token for the salesforce oath2. access token can expire after some time and after that we need to refresh the access token. But I am always getting “Bad Request” error in this code.

function getRefreshToken(refreshToken) {
    var url = loginUrl + 'token';
    var client = Ti.Network.createHTTPClient({

        // // function called when the response data is available
        onload : function(e) {
            Ti.API.info("Received text: " + this.ResponseText);
            alert(this.status);
            alert(this.responseText);

        },
        //  function called when an error occurs, including a timeout
        onerror : function(e) {
            Ti.API.debug(e.error);
            alert(this.status);
            alert(e.error);
        },
        timeout : 5000   //in milliseconds
    });
    //Prepare the connection.
    client.open("POST", url);
    client.setRequestHeader("content-type", "application/json");
    //Send the request.
    var param = 'grant_type=refresh_token&client_id=' + escape(clientId) + '&client_secret='+ escape(clientSecret) + '&refresh_token=' + escape(refreshToken);
    Ti.API.info(param);
    client.send(param);

}

am I missing something in this code? expected result is a json response with new access_token.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:25:40+00:00Added an answer on May 31, 2026 at 3:25 pm

    What the exact URL you send the request to? Also, you set the request content-type to be json, but seem to be sending a forms request, not a json formatted request, you probably need to change the content-type header to be “application/x-www-form-urlencoded”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone been able to get the OAuth access token for a user after
I've successfully managed to get an OAuth access token and am able to make
I have been able to successfully get an access token from Vimeo using the
I need to be able get a single specific attribute from an element with
This is the code that i used.I am only able to get the name
after I did some research on the subject, I found that Windows Live stopped
Why do I need to obtain an access token? Also, should I store this?
I'm trying to get the access token of my app using graph api, by
I am trying to get the access token for LinkedIn Here's the part of
I am trying to get access token using from facebook graph API in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.