开发者Skip to main content

  1. 文件
  2. 收费

合作伙伴令牌

POST https://auth.tesla.cn/oauth2/v3/token

生成用于管理合作伙伴账户或其拥有的设备的令牌。

参数

名称必填示例描述
grant_typeclient_credentials授权类型必须是client_credentials。
client_idabc-123合作伙伴应用程序客户端ID。
client_secretsecret-password合作伙伴应用程序客户端密钥。
audiencehttps://fleet-api.prd.cn.vn.cloud.tesla.cn生成令牌的受众。
scopeopenid user_data vehicle_device_data vehicle_cmds vehicle_charging_cmds以空格分隔的范围列表。

示例请求

CLIENT_ID=<获取client_id的命令>
CLIENT_SECRET=<安全获取client_secret的命令>
AUDIENCE=" https://fleet-api.prd.cn.vn.cloud.tesla.cn"
# 合作伙伴身份验证令牌请求
curl --request POST \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'grant_type=client_credentials' \
  --data-urlencode "client_id=$CLIENT_ID" \
  --data-urlencode "client_secret=$CLIENT_SECRET" \
  --data-urlencode 'scope=openid vehicle_device_data vehicle_cmds vehicle_charging_cmds' \
  --data-urlencode "audience=$AUDIENCE" \
  'https://auth.tesla.cn/oauth2/v3/token'