# getAuthCode ![AI 智能摘要](https://gw.alicdn.com/imgextra/i4/O1CN01Zx4PED22rkUkmRe1L_!!6000000007174-2-tps-226-40.png)![>](https://gw.alicdn.com/imgextra/i2/O1CN01UwOv1C27lrTuGFj2D_!!6000000007838-2-tps-17-30.png) 更新于 2025-08-27 调用 dd.getAuthCode,获取应用免登授权码。 > - 免登是指用户进入应用后,无需输入钉钉用户名和密码,应用程序可自动获取当前用户登录系统的流程。 > - 在免登流程中需要向钉钉获取免登授权码,即是通过调用该api获取。获取的免登授权码有效期5分钟,且只能使用一次。 具体免登流程如下: 1. 调用本接口获取免登授权码。 2. 调用[获取应用的 Access Token](https://open.dingtalk.com/document/orgapp/api-gettoken)接口,获取应用访问凭证。 3. 调用[通过免登码获取用户信息](https://open.dingtalk.com/document/orgapp/obtain-the-userid-of-a-user-by-using-the-log-free)接口,获取用户userid。 4. 调用[查询用户详情](https://open.dingtalk.com/document/orgapp/query-user-details)接口,获取用户信息。 > 小程序免登具体操作内容,可参考[小程序应用免登](https://open.dingtalk.com/document/orgapp/small-program-application-free-of-registration),包含Demo 示例。 ## 支持说明 | 应用能力 | Android | iOS | Harmony | Mac | Windows | 预览效果 | |--------------|---------|-------|---------|-------|---------|------| | 网页应用(原H5微应用) | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | - | | 小程序 | 6.0.0 | 6.0.0 | 不支持 | 6.0.0 | 6.0.0 | 去预览 | ## 支持应用类型 | 应用类型 | 是否支持调用 | |---------|--------| | 企业内部应用 | 是 | | 第三方企业应用 | 是 | | 第三方个人应用 | 是 | ## 鉴权规则 无需鉴权即可直接调用 ## **参数说明** 继承[通用输入对象](https://open.dingtalk.com/document/direction/jsapi-standard-input-output-object),扩展属性描述: | 名称 | 类型 | 是否必填 | 示例值 | 描述 | |--------|--------|------|--------------|------------| | corpId | String | 是 | ding12345xxx | 企业 CorpID。 | ## **返回结果** 继承[通用输出对象](https://open.dingtalk.com/document/direction/jsapi-standard-input-output-object),扩展属性描述: | 名称 | 类型 | 示例值 | 描述 | |----------|--------|-------------|----------------------------| | authCode | String | hYLK98jkf0m | 授权码。有效期5分钟,且只能使用一次,使用后会失效。 | ## **错误码** | **错误码** | **描述** | |-----|------| | 3 | 系统异常 | ## **示例****代码** ### 默认出入参 dd.getAuthCode({   corpId: 'ding12345xxx',   success: (res) \=> {     const { authCode } \= res;   },   fail: () \=> {},   complete: () \=> {}, }); `success`返回对象示例: { "authCode": "hYLK98jkf0m" }