I need to do all my actions on the back-end, no browser.
In the documentation I see I need the following values to get the Authorization: bearer ????????
value.
curl -i -X POST https://api.surveymonkey.net/oauth/token -d \
"client_secret=YOUR_CLIENT_SECRET \
&code=AUTH_CODE \
&redirect_uri=YOUR_REDIRECT_URI \
&client_id=YOUR_CLIENT_ID \
&grant_type=authorization_code"
I am not building an app, I just want to connect to my account to fetch all surveys.
Where do I get the values for:
YOUR_CLIENT_SECRET
AUTH_CODE
YOUR_CLIENT_ID
What do I put in YOUR_REDIRECT_URI as there is no such thing in back-end actions.
You always need an application created in order to get an access token. There is an undocumented method for backend API access (for the app owner) using the grant type client_credentials
.
curl -X POST \
https://api.surveymonkey.net/oauth/token \
-H 'content-type: application/x-www-form-urlencoded' \
-d 'client_secret=<secret>&client_id=<client_id>&grant_type=client_credentials'
This should work for getting access to your own account.
With regards to the app, you can leave the redirect URI alone. Note if you go to the settings page of your app, it also provides you with an access token to use, but I would advise using the above flow as a way to handle tokens being revoked or expired in the future.