We Want to Hear From You! What Do You Want to See on the Community? Tell us here!

Forum Discussion

RupeshShah's avatar
RupeshShah
New member | Level 2
2 years ago

{"error": "invalid_grant", "error_description": "refresh token is malformed"}

I am taking refresh_token from Access code generated offline. 

 

I am able to get with refresh_token from the access code generated earlier. 

 

Now i have modified permission so i generated new access code , however with new access code i getting the following error

 

{"error": "invalid_grant", "error_description": "refresh token is malformed"}

 

where am i making mistake ? 

 

access code  length i got earlier ( which is still working)  is 64 characters 

 

Where as new access code length is only 43 characters

 

Request please help.

 

 

2 Replies

  • RupeshShah's avatar
    RupeshShah
    New member | Level 2
    2 years ago

    I am using this in vb.net with restapi 

     

    Dim link1 As String = "https://api.dropbox.com/oauth2/token"

            Dim client = New RestClient(link1)

            client.Timeout = -1

            mToken = ""

            Dim request = New RestRequest(Method.[POST])

            request.AddHeader("Content-Type", "application/x-www-form-urlencoded")

            request.AddParameter("refresh_token", "UF2xaUcddPOfkhAAAAyAAAIT0EEMOQHza-Gemg5atvn")  -- token changed

            request.AddParameter("grant_type", "refresh_token")

            request.AddParameter("client_id", "xxxxxxx")

            request.AddParameter("client_secret", "vvvvvvvv")

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

            Dim response As IRestResponse = client.Execute(request)

            Console.WriteLine(response.Content)

            Dim xmld As String

            xmld = response.Content

            Dim jsonString As String = xmld

            Dim jsonDynamic As Object = JsonConvert.DeserializeObject(jsonString)

            fieldValue = jsonDynamic("access_token").ToString() ' Replace "fieldName" with the actual field name you want to access

  • RupeshShah's avatar
    RupeshShah
    New member | Level 2
    2 years ago

    ok I could get the resolution. 

     

    The code which i was getting with offline mode i needed to use once for getting refresh token.  using https://api.dropbox.com/oauth2/token

     

    once i got refresh token now i can regenerate access_token multiple times. 

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API
Make connections with other developers814 PostsLatest Activity: 2 hours ago
274 Following

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!