如何使用 OAuth2 从奇妙清单获取访问令牌

how to get an access token from wunderlist using OAuth2

如何使用 oauth 从奇妙清单 api 获取访问令牌?

奇妙清单文档说:

  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


我不明白

Exchange code for an access token

我应该重定向到 https://www.wunderlist.com/oauth/access_token 以获得访问令牌吗?

code 交换为 access_token 是通过向令牌端点执行 HTTP POST 消息来完成的,在您的例子中是 https://www.wunderlist.com/oauth/access_token, with JSON data as specified in: https://developer.wunderlist.com/documentation/concepts/authorization。使用 cURL 看起来像:

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