Open svu-aau opened 2 years ago
Bumping issue in hopes for a response. Thanks! Steve
After creating your application, obtaining your OAuth code interactively, you can use your authorization code to obtain your access token and refresh token and store those secrets for batch/CLI/scheduled jobs type use:
In a browser go to https://app.formassembly.com/oauth/login?type=web&client_id=CLIENT_ID&redirect_uri=DO_NOT_CHANGE&response_type=code
after replacing:
curl --location --request POST 'https://app.formassembly.com/oauth/access_token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=authorization_code' \ --data-urlencode 'type=web_server' \ --data-urlencode 'client_id=CLIENT_ID' \ --data-urlencode 'client_secret=CLIENT_SECRET' \ --data-urlencode 'redirect_uri=DO_NOT_CHANGE' \ --data-urlencode 'code=CODE_FROM_PREVIOUS_STEP'
This will return an access token, a refresh token which will be used to get a new access token in the future (after expire_in seconds):
{ "access_token": ACCESS_TOKEN, "expires_in": 315360000, "scope": null, "refresh_token": REFRESH_TOKEN }
Thanks @edasque!
I was able to get the access token and refresh token using your directions.
Can you please also provide the curl
example on how to get a new access token using the refresh token? I tried to use the same curl
code above with the following changes:
grant_type
to refresh_token
code
paramrefresh_token
param and set it to the refresh token receivedSo basically:
curl --location --request POST 'https://app.formassembly.com/oauth/access_token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=refresh_token' \ --data-urlencode 'type=web_server' \ --data-urlencode 'client_id=CLIENT_ID' \ --data-urlencode 'client_secret=CLIENT_SECRET' \ --data-urlencode 'redirect_uri=DO_NOT_CHANGE' \ --data-urlencode 'refresh_token=myrefreshToken'
The response was:
{
"error": "invalid_grant4"
}
thanks, Steve
hi @edasque , following up to see if you have an update to above question on how to use the refresh_token to get a new access_token.
much appreciated, Steve
Hi @svu-aau , it seems there is a bug around renewal of the token, we'll tackle it soon. In the mean time, the token is long lasting so you wouldn't need to refresh for a long while.
thanks @edasque !
Trying to access the FormAssembly login API
Getting an response as {"error":"invalid_grant1-2-14"}
Please advice
Hi,
We are hoping to write command line scripts to automate some processes that will update forms or check connectors. Does FA support other oAuth2 grant_types, like
password
? At first glance, I only noticeauthorization_code
, which requires user interaction.thanks, Steve