Documentation ¶
Overview ¶
Package auth 登录
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RespCode2Session ¶
type RespCode2Session struct { microapp.Error Openid string `json:"openid"` // 用户在当前小程序的 ID,如果请求时有 code 参数才会返回 SessionKey string `json:"session_key"` // 会话密钥,如果请求时有 code 参数才会返回 AnonymousOpenid string `json:"anonymous_openid"` // 匿名用户在当前小程序的 ID,如果请求时有 anonymous_code 参数才会返回 }
code2Session
通过login接口获取到登录凭证后,开发者可以通过服务器发送请求的方式获取 session_key 和 openId。
See: https://microapp.bytedance.com/docs/zh-CN/mini-app/develop/server/log-in/code-2-session
GET https://developer.toutiao.com/api/apps/jscode2session
RespCode2Session struct
func Code2Session ¶
Example ¶
package main import ( "fmt" "net/url" "github.com/jackluo2012/microapp" "github.com/jackluo2012/microapp/apis/auth" ) func main() { var ctx *microapp.MicroApp params := url.Values{} resp, err := auth.Code2Session(ctx, params) fmt.Println(resp, err) }
Output:
Click to show internal directories.
Click to hide internal directories.