本文为您介绍了钉钉免登API接口的参数详情和示例代码等相关信息。

1、Token Exchange API

请求信息
  • URL:http://signin.rhinokeen.com/oauth/token_exchange
  • 请求类型:POST
  • HEADER:set client_id and client_secret as base64(client_id:client_secret) in basic authentication header like: "authorization: Basic ZGluZ2Rpbmc6MjQ3ZjM5NjgtYjIyZi00NjE4LTgyOWYtZTc5ODkzODg1ZjQw"

请求参数

参数名称 类型 是否必须 描述
grant_type String "urn:ietf:params:oauth:grant-type:token-exchange"
scope String "fuyun-dev"
redirect_url String 注册app的callbackURL
subject_token String 第三方token(钉钉的accessToken)
subject_issuer String "dingding" (第三方issuer)
user_id String 钉钉user id

成功返回示例

{
    "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwOi8vZGV2ZWxvcGVyLnJoaW5va2Vlbi5jb20iLCJleHAiOjE1OTk3OTczNjMsInVzZXJfbmFtZSI6IumjkuWymiIsImp0aSI6ImI3NzRlZjEzLWE1YmMtNGM3Yi04MzQ2LTA0MmQ4NzllZmIxYSIsImNsaWVudF9pZCI6ImRpbmdkaW5nIiwic2NvcGUiOlsiZnV5dW4tZGV2Il19.jAEBjO9N0D6vjTA0tx8uiAh5dzDgSpo-LVHBmDIMnGVRSvJQWvEc3r6zrp2bRbK7pv83aouhSarHIhtUZ4O-utxP6vMAsGheQstNrXHk79J1XkK-UEXXJXznEyqJvgqjtRw8dTUA2PKSM-1CjRgdRDLvcD7kUGCTAFyYnHwrtdeDw6Vkq1IvkQ3jo4mlTa5pYjF_trXUdAil09IDYk4HNzKHYmuWaAKko42w7abv0GjF7LkNQWM4g6NY3otyge7kxkSHT8K4pOlD7O0zqZlRWfaUXjfGY6H3gdDeRU5N3NyyUXBt2I4VM7pZsW-qwR0XjacdasV5J8UObP37_WzEEw",
    "token_type": "bearer",
    "refresh_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiLpo5LlspoiLCJzY29wZSI6WyJmdXl1bi1kZXYiXSwiYXRpIjoiYjc3NGVmMTMtYTViYy00YzdiLTgzNDYtMDQyZDg3OWVmYjFhIiwiaXNzIjoiaHR0cDovL2RldmVsb3Blci5yaGlub2tlZW4uY29tIiwiZXhwIjoxNTk5ODQ0MTU5LCJqdGkiOiJjOTQ5N2ExMi1kZWE5LTRhYmYtOTgxYS0xYjQ1MTRkZWI2MDUiLCJjbGllbnRfaWQiOiJkaW5nZGluZyJ9.NlZ0ay2u0KcxUbgSnacoFw9YwVUJ6cOqwS_vhO92klZroedKzii3vw2rYzbDhTJQshaRgDdAtL2HVrI0bkuWB-T0IuLd_QEnpcDRujqjovxKKJN-uQack5GEd8AwBKYG67IiSGUztIn-RNXO9wGNPM18gQKACc8E34JRbgXnZL6sR6651_pJNT5LpItDe4juDHPgmLpNOHl5Um7wUiE0PpR21d9atJPy5Kt4LL4b4Tnbbtexhofg_vxWVqebNlh-2-nKJyryaKV9otlP0BEh21K-0MFVRotIuAVOwN7goObG6x5KEKFBI8lxI0s9An38TqQzJ1LvzIh77XG7wIDzFg",
    "expires_in": 3599,
    "scope": "fuyun-dev",
    "iss": "http://developer.rhinokeen.com",
    "jti": "b774ef13-a5bc-4c7b-8346-042d879efb1a"
}

错误返回示例

{
    "error": "invalid_grant",
    "error_description": "Invalid refresh token: 1631958c-df3a-4acd-ac1f-829bcbb6caf01"
}

2、Refresh token API

请求信息
  • URL:http://signin.rhinokeen.com/
  • 请求类型:GET
  • HEADER:set client_id and client_secret as base64(client_id:client_secret) in basic authentication header like: "authorization: Basic ZGluZ2Rpbmc6MjQ3ZjM5NjgtYjIyZi00NjE4LTgyOWYtZTc5ODkzODg1ZjQw"

请求参数

参数名称 类型 是否必须 描述
refresh_token String refresh_token
grant_type String refresh_token

成功返回示例

{
    "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwOi8vZGV2ZWxvcGVyLnJoaW5va2Vlbi5jb20iLCJleHAiOjE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4LL4b4Tnbbtexhofg_vxWVqebNlh-2-nKJyryaKV9otlP0BEh21K-0MFVRotIuAVOwN7goObG6x5KEKFBI8lxI0s9An38TqQzJ1LvzIh77XG7wIDzFg",
    "expires_in": 3599,
    "scope": "fuyun-dev",
    "iss": "http://developer.rhinokeen.com",
    "jti": "b774ef13-a5bc-4c7b-8346-042d879efb1a"
}

失败返回示例

{
    "error": "invalid_grant",
    "error_description": "Invalid refresh token: 1631958c-df3a-4acd-ac1f-829bcbb6caf01"
}