-
Notifications
You must be signed in to change notification settings - Fork 25
依托答辩,我就想用accessToken,https调一个API,看了半天阿里云文档看不出个所以然,阿里云泰酷辣 #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
同感 |
试了半天,终于跑起来了,文档确实一坨屎。 @Ccheng2729111 import dingtalk from '@alicloud/dingtalk';
// @ts-ignore
let client = new dingtalk.oauth2_1_0.default({
protocol: 'https',
regionId: 'central',
});
const getAccessTokenRequest = new dingtalk.oauth2_1_0.GetAccessTokenRequest({
appKey: 'xxx',
appSecret:
'xxxx',
});
try {
const res = await client.getAccessToken(getAccessTokenRequest);
console.log(res.body.accessToken,res.body.expireIn);
} catch (err) {
console.log(err);
} |
const { default: Dysmsapi20170525 } = require("@alicloud/dysmsapi20170525");
const { Config } = require("@alicloud/openapi-client");
const { default: Credential } = require("@alicloud/credentials");
const config = new Config({
credential: new Credential(),
regionId: "cn-shanghai",
protocol: "http",
accessKeyId: process.env.ACCESS_KEY_ID,
accessKeySecret: process.env.ACCESS_KEY_SECRET,
});
const dysmsapiClient = new Dysmsapi20170525(config);
let idiot = await dysmsapiClient.sendSms({
phoneNumbers: 111111111,
signName: "xxx",
templateCode: "SMS_111111",
templateParam: `{"code":"${c.code}"}`,
}); 经过测试,能跑。 |
同感,阿里真是没落了,很简单东西,搞得巨复杂,文档写得一坨ss |
同感,一个那么简单的东西写的比专利还难懂,牛逼 |
可能我们的水平都太低了。 😄 |
阿里云的文档和客户端都非常差,不介意可以试试最近封装的一个 client,基础功能有了,接口定义还在开发生成工具 https://github.com/wenerme/wode/tree/main/packages/client#alicloud |
能把一个短信包封装这么好,文档写的如此专业化,我相信阿里会引领世界100年不动摇 |
阿里的确走下坡路了,就如同现在的淘宝,上比不了JD下比不了拼多多 |
哈哈哈,完全同意,发个短信这么麻烦,这太阿里了 |
What can we do? Uh? 😄 |
感谢反馈。 关于SDK快速接入,我们制作了自动生成示例代码文档,完整工程中包含README文件,内含代码启动指令。https://help.aliyun.com/zh/sdk/developer-reference/how-to-automatically-generate-an-sdk-example 上述JS的问题,因为我们之前生成的都是TypeScript代码示例,可能理解上比较复杂,现在门户已经支持自动生成NodeJs代码示例了。 |
@TsinghuaDream 生成的好垃圾, 还好我只用jd购物 发验证码就几行代码的事情, 搞得不造火箭还复杂. import SMSClient from '@alicloud/sms-sdk'
const smsClient = new SMSClient({
accessKeyId: 'your key id',
secretAccessKey: 'your secret',
})
const response = await smsClient.sendSMS({
...
} 简单明了, 你看看文档里都是什么乐色. |
笑死
The text was updated successfully, but these errors were encountered: