Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@wecom/cloudbase-framework-plugin-node-sdk
Advanced tools
import tcb from '@cloudbase/node-sdk'
import wecom from '@wecom/cloudbase-framework-plugin-node-sdk'
const app = wecom.init({
cloudbase: tcb.init({
env: tcb.SYMBOL_CURRENT_ENV,
}),
})
const token = await app.getSuiteAccessToken({ suiteId })
console.log(token)
getProviderAccessToken
获取服务商凭证
app.getProviderAccessToken()
返回说明
string
,服务商凭证
getSuiteTicket
获取第三方应用票据
app.getSuiteTicket({ suiteId })
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
suiteId | string | 是 | 第三方应用 ID |
返回说明
string
,第三方应用票据
getSuiteSecret
获取第三方应用 secret
app.getSuiteSecret({ suiteId })
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
suiteId | string | 是 | 第三方应用 ID |
返回说明
string
,第三方应用 secret
getSuiteAccessToken
获取第三方应用凭证
app.getSuiteAccessToken({ suiteId })
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
suiteId | string | 是 | 第三方应用 ID |
返回说明
string
,第三方应用凭证
getAuthInfo
获取应用授权信息
app.getAuthInfo({ suiteId, corpId })
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
suiteId | string | 是 | 第三方应用 ID |
corpId | string | 是 | 授权方企业 ID |
返回说明
Object
,应用授权信息
参数 | 类型 | 说明 |
---|---|---|
permanentCode | string | 永久授权码 |
agentId | number | 授权方应用 ID |
getCorpAccessToken
获取企业凭证
app.getCorpAccessToken({ suiteId, corpId })
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
suiteId | string | 是 | 第三方应用 ID |
corpId | string | 是 | 授权方企业 ID |
返回说明
string
,授权方企业凭证
getCorpJSAPITicket
获取企业 jsapi_ticket
app.getCorpJSAPITicket({ suiteId, corpId })
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
suiteId | string | 是 | 第三方应用 ID |
corpId | string | 是 | 授权方企业 ID |
返回说明
string
,企业 jsapi_ticket
getCorpJSAPISignature
获取企业 jsapi 签名
app.getCorpJSAPISignature({ suiteId, corpId })
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
suiteId | string | 是 | 第三方应用 ID |
corpId | string | 是 | 授权方企业 ID |
返回说明
string
,企业 jsapi 签名
getAgentJSAPITicket
获取应用 jsapi_ticket
app.getAgentJSAPITicket({ suiteId, corpId })
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
suiteId | string | 是 | 第三方应用 ID |
corpId | string | 是 | 授权方企业 ID |
返回说明
string
,应用 jsapi_ticket
getAgentJSAPISignature
获取应用 jsapi 签名
app.getAgentJSAPISignature({ suiteId, corpId })
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
suiteId | string | 是 | 第三方应用 ID |
corpId | string | 是 | 授权方企业 ID |
返回说明
string
,应用 jsapi 签名
createSession
消费 OAuth code 并记录成员和登录态
app.createSession({ suiteId, code })
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
suiteId | string | 是 | 第三方应用 ID |
code | string | 是 | OAuth code |
返回说明
Object
,新增登录态信息
参数 | 类型 | 说明 |
---|---|---|
sid | string | Session ID |
suiteId | string | 第三方应用 ID |
deviceId | string | 手机设备号 |
userInfo | Object | 用户信息,见 WWOAuthUserInfo |
createTime | number | 创建时间戳 |
accessTime | number | 最后访问时间戳 |
ticketInfo | Object | 成员票据信息,见 WWTicketInfo |
getSession
获取登录态
app.getSession({ sid })
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
sid | string | 是 | createSession 返回的 sid |
返回说明
Object
,登录态信息
参数 | 类型 | 说明 |
---|---|---|
sid | string | Session ID |
suiteId | string | 第三方应用 ID |
deviceId | string | 手机设备号 |
userInfo | Object | 用户信息,见 WWOAuthUserInfo |
createTime | number | 创建时间戳 |
accessTime | number | 最后访问时间戳 |
deleteSession
删除登录态
app.deleteSession({ sid })
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
sid | string | 是 | createSession 返回的 sid |
getUser
获取用户信息
app.getUser({ openUserId })
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
openUserId | string | 是 | createSession 返回的 openUserId |
返回说明
Object
,用户信息,见 WWOAuthUserInfo
deleteUser
删除用户信息
app.deleteUser({ openUserId })
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
openUserId | string | 是 | createSession 返回的 openUserId |
request
请求企业微信 Open API
app.request({
name: 'service/getuserinfo3rd',
query: { suite_access_token: suiteAccessToken, code: query.code }
})
参数说明
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
name | string | 是 | createSession 返回的 openUserId |
query | Object | 否 | 请求 query 参数 |
body | Object | 否 | 请求 body 参数 |
method | string | 否 | 请求方法,默认 body 为空时为 GET,否则为 POST |
返回说明
Object
,Open API 返回数据。该接口会自动处理 errcode 逻辑,当 errcode 不为 0 时将自动抛出 Error
interface WWOAuthUserInfo {
/** 用户所属企业 ID */
corpId: string;
/** 用户在企业内的用户 ID,该企业与第三方应用有授权关系时,返回明文用户 ID,否则返回密文用户 ID */
userId: string;
/** 全局唯一。对于同一个服务商,不同应用获取到企业内同一个成员的open_userid是相同的,最多64个字节。仅第三方应用可获取 */
openUserId: string;
}
interface WWTicketInfo {
/**
* 成员票据,最大为512字节
*
* 后续利用该参数可以获取用户信息或敏感信息,见 [第三方使用user_ticket获取成员详情](https://open.work.weixin.qq.com/api/doc/90001/90143/91122)
*/
userTicket: string;
/** user_ticket的有效时间(秒),随user_ticket一起返回 */
expiresIn: number;
}
FAQs
云开发 CloudBase Framework 框架「企业微信第三方应用」插件 Node SDK。
The npm package @wecom/cloudbase-framework-plugin-node-sdk receives a total of 2 weekly downloads. As such, @wecom/cloudbase-framework-plugin-node-sdk popularity was classified as not popular.
We found that @wecom/cloudbase-framework-plugin-node-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.