I would like to make sure I am understanding <this...
# suitescript
a
I would like to make sure I am understanding this document to generate a refresh token correctly. I create the string ``Basic ${client_id}:{client_secret}`` and put the base64 representation in the header under Authorization. Then I make a post request to
{token_url}?grant_type=refresh_token&refreshtoken=${refreshtoken}
where refresh token is the refresh token value in the json token.
b
you dont base64 encode 'Basic '
a
I miswrote that. Other than that it looks good?
b
form encode the request parameters
a
I'm not sure what you mean.
b
lookup application/x-www-form-urlencoded
a
Ah OK.
So the second string
granttype...
is in the body or in the url? Also is the refresh token the entire token (including the regular access token) or just the refresh token value?
b
look into form encoding harder, its a way of encoding parameters into the body
the minor spoiler is that you should be using a library that does the encoding for you
a
I am getting
unsupported grant type
yet the grant_type is refresh_token? Can it be an issue with the refresh_token value?
b
what does your request look like
a
message has been deleted
b
same mistake as the old stuff you gave
you arent getting the content type correct
nor the http method
use an echo service like httpbin.org if you dont know how to examine what your requests ends up looking like
a
That was embarrassing. Switched the method and the encoding then it worked. Thanks for the help.