跳转到内容

Authentication

:::提示 Wink IAM 身份验证服务器支持常见的 OAuth2 端点:

  • /oauth2/授权
  • /oauth2/令牌
  • /oauth2/内省
  • /oauth2/撤销
  • /oauth2/用户信息 :::

应用程序为您提供Client IDSecret Key您需要创建一个经过身份验证的 OAuth2 会话,以便与 Wink 和 TripPay API 进行通信。

以下是创建经过身份验证的会话的步骤。

步骤 1. 在暂存区或生产环境中检索访问令牌:

您很可能会使用适合您语言的强大 OAuth2 库,它将为您完成所有繁重的工作。 我们的示例将展示命令行中最基本的用法,使用curl

Terminal window
curl -X POST https://staging-iam.wink.travel/oauth2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=<YOUR_CLIENT_ID>" \
-d "client_secret=<YOUR_SECRET_KEY>"
Terminal window
curl -X POST https://iam.wink.travel/oauth2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=<YOUR_CLIENT_ID>" \
-d "client_secret=<YOUR_SECRET_KEY>"

这将返回一个访问令牌以及其他 OAuth2 响应数据:

{
"access_token": "abc123"
}

当您调用我们的任何端点时,请在标头中包含以下内容:

  • Wink-Version=2.0 最新的 - 请参阅我们的 API 文档以了解其他可用版本。
  • Authentication=Bearer: ${access_token} 插入您的访问令牌。