oauthoauth-2.0wunderlist

how to get an access token from wunderlist using OAuth2


How do you get an access token from the wunderlist api using oauth?

The wunderlist documentation says:

  1. Wunderlist redirects back to your site
    If the user accepts your request, Wunderlist will redirect to your redirect_uri with a temporary code in a code parameter as well as the state you provided in the previous step in a state parameter. If the states don't match, the request has been created by a third party and the process should be aborted.

    Exchange code for an access token: POST https://www.wunderlist.com/oauth/access_token


I do not understand

Exchange code for an access token

am I supposed to redirect to https://www.wunderlist.com/oauth/access_token to get an access token?


Solution

  • Exchanging the code for an access_token is done by executing an HTTP POST message to the token endpoint, in your case to https://www.wunderlist.com/oauth/access_token, with JSON data as specified in: https://developer.wunderlist.com/documentation/concepts/authorization. Using cURL it would look like:

    curl -H "Content-Type: application/json" -d '{ "code":"<CODE>", "client_id": "<CLIENT_ID>", "client_secret": "<CLIENT_SECRET>"}' https://www.wunderlist.com/oauth/access_token