Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cute-angelia/bytedance-microapp
字节小程序 抖音小程序 bytedance microapp sdk
https://github.com/cute-angelia/bytedance-microapp
bytedance bytedance-miniapp douyin
Last synced: 6 days ago
JSON representation
字节小程序 抖音小程序 bytedance microapp sdk
- Host: GitHub
- URL: https://github.com/cute-angelia/bytedance-microapp
- Owner: cute-angelia
- Created: 2022-04-24T10:26:00.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-03-10T04:26:03.000Z (almost 2 years ago)
- Last Synced: 2024-06-20T03:38:18.861Z (7 months ago)
- Topics: bytedance, bytedance-miniapp, douyin
- Language: Go
- Homepage:
- Size: 51.8 KB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# cute-angelia/bytedance-microapp
字节跳动小程序,抖音小程序
### 快速开始 & demo
```shell
go get github.com/cute-angelia/bytedance-microappimport (
"github.com/cute-angelia/bytedance-microapp/microapp"
)
``````go
// 初始化
// 方法一
microapp.New(microapp.WithAppId(""), microapp.WithAppSecret(""))// 方法二 采用配置文件
conf.LoadConfigFile("./config.toml")
microapp.Load("microapp")// 调用 Api 如 GetAccessToken
microApp := microapp.New(microapp.WithAppId(""), microapp.WithAppSecret(""))
accessToken := microApp.GetAccessToken()
```### 登录流程
1. 不授权登陆
不授权登陆只需要客户端获取 code
1. 客户端获取 tt.login 获取 code
2. 服务端调用 code2session 根据 openid 记录用户2. 授权登陆
需要用户点击授权
1. 客户端获取 tt.login 获取 code
2. 客户端调用 tt.getUserInfo 获取 encryptedData 和 iv
3. 将这些数据发送服务端进行解密