auth

package
v1.0.0-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2020 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package auth 登录

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Code2Session

func Code2Session(ctx *microapp.MicroApp, params url.Values) (resp []byte, err error)

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

Example
package main

import (
	"fmt"
	"net/url"

	"github.com/fastwego/microapp"
	"github.com/fastwego/microapp/apis/auth"
)

func main() {
	var ctx *microapp.MicroApp

	params := url.Values{}
	resp, err := auth.Code2Session(ctx, params)

	fmt.Println(resp, err)
}

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL