https://github.com/leaf4monkey-npm/youzan-login
https://github.com/leaf4monkey-npm/youzan-login
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/leaf4monkey-npm/youzan-login
- Owner: leaf4monkey-npm
- Created: 2017-06-01T13:02:21.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-05T03:57:18.000Z (about 9 years ago)
- Last Synced: 2025-08-21T09:03:54.791Z (10 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Youzan-Login
有赞 AppSDK 的登录态 API
### Usage
```js
const Youzan = require('../lib');
let youzan = new Youzan('client_id', 'client_secret');
let promise = youzan.initToken()
.then(res => {
//{
// "code": 0,
// "msg": "success",
// "data": {
// "access_token": "6460257b9aaf38c494d55a2c432bd4c9",
// "cookie_key": null,
// "cookie_value": null
// }
//}
return res;
})
.catch(e => {
console.log(e);
throw e;
});
```
### Apis
- `constructor (clientId: string, clientSecret: string)` 初始化有赞工具型应用提供的 `client_id` 和 `client_secret`
- `initToken ()` 获取初始化 token
- `login ()` 登录
- `logout ()` 登出