auth

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package auth 授权相关API

Index

Constants

View Source
const (
	// SHOP_AUTH_WEB_URL 拼多多店铺WEB端网页授权
	SHOP_AUTH_WEB_URL = "https://fuwu.pinduoduo.com/service-market/auth"
	// SHOP_AUTH_H5_URL 拼多多店铺H5移动端网页授权
	SHOP_AUTH_H5_URL = "https://mai.pinduoduo.com/h5-login.html"
	// DDK_AUTH_URL 多多进宝推手WEB端网页授权
	DDK_AUTH_URL = "https://jinbao.pinduoduo.com/open.html"
	// KTT_AUTH_URL 快团团团长WEB端网页授权
	KTT_AUTH_URL = "https://oauth.pinduoduo.com/authorize/ktt"
	// LOGISTIC_AUTH_URL 拼多多电子面单用户WEB端网页授权
	LOGISTIC_AUTH_URL = "https://wb.pinduoduo.com/logistics/auth"
)
View Source
const (
	// H5 view h5
	H5 string = "h5"
	// WEB view web
	WEB string = "web"
)

Variables

This section is empty.

Functions

func URL

func URL(clt *core.SDKClient, req *URLRequest) string

URL 组装授权页URL

Types

type AuthType

type AuthType int

AuthType 授权类型

const (
	// AuthType_SHOP_WEB 拼多多店铺WEB端
	AuthType_SHOP_WEB AuthType = iota
	// AuthType_SHOP_H5 拼多多店铺H5移动端网页授权
	AuthType_SHOP_H5
	// AuthType_DDK 多多进宝推手WEB端网页授权
	AuthType_DDK
	// AuthType_KTT 快团团团长WEB端网页授权
	AuthType_KTT
	// AuthType_LOGISTIC 拼多多电子面单用户WEB端网页授权
	AuthType_LOGISTIC
)

type Token

type Token struct {
	model.BaseResponse
	OwnerName             string           `json:"owner_name,omitempty" xml:"owner_name,omitempty"`
	OwnerID               model.FlexUint64 `json:"owner_id,omitempty" xml:"owner_id,omitempty"`
	AccessToken           string           `json:"access_token,omitempty" xml:"access_token,omitempty"`
	RefreshToken          string           `json:"refresh_token,omitempty" xml:"refresh_token,omitempty"`
	ExpiresIn             int64            `json:"expires_in,omitempty" xml:"expires_in,omitempty"`
	ExpiresAt             int64            `json:"expires_at,omitempty" xml:"expires_at,omitempty"`
	RefreshTokenExpiresIn int64            `json:"refresh_token_expires_in,omitempty" xml:"refresh_token_expires_in,omitempty"`
	RefreshTokenExpiresAt int64            `json:"refresh_token_expires_at,omitempty" xml:"refresh_token_expires_at,omitempty"`
	W1ExpiresIn           int64            `json:"w1_expires_in,omitempty" xml:"w1_expires_in,omitempty"`
	W1ExpiresAt           int64            `json:"w1_expires_at,omitempty" xml:"w1_expires_at,omitempty"`
	W2ExpiresIn           int64            `json:"w2_expires_in,omitempty" xml:"w2_expires_in,omitempty"`
	W2ExpiresAt           int64            `json:"w2_expires_at,omitempty" xml:"w2_expires_at,omitempty"`
	R1ExpiresIn           int64            `json:"r1_expires_in,omitempty" xml:"r1_expires_in,omitempty"`
	R1ExpiresAt           int64            `json:"r1_expires_at,omitempty" xml:"r1_expires_at,omitempty"`
	R2ExpiresAt           int64            `json:"r2_expires_at,omitempty" xml:"r2_expires_at,omitempty"`
	R2ExpiresIn           int64            `json:"r2_expires_in,omitempty" xml:"r2_expires_in,omitempty"`
	Scope                 []string         `json:"scope,omitempty" xml:"scope,omitempty"`
}

Token 调用令牌

func TokenCreate

func TokenCreate(clt *core.SDKClient, code string) (*Token, error)

TokenCreate 获取Access Token

func TokenRefresh

func TokenRefresh(clt *core.SDKClient, refreshToken string) (*Token, error)

TokenRefresh 刷新Access Token

type TokenCreateRequest

type TokenCreateRequest struct {
	// Code 授权code,grantType==authorization_code 时需要
	Code string `json:"code,omitempty"`
}

TokenCreateRequest 获取Access Token API Request

func (TokenCreateRequest) GetType

func (r TokenCreateRequest) GetType() string

GetType implement Request interface

type TokenCreateResponse

type TokenCreateResponse struct {
	model.CommonResponse
	// Response response
	Response *Token `json:"pop_auth_token_create_response,omitempty" xml:"pop_auth_token_create_response,omitempty"`
}

TokenCreateResponse 获取Access Token API Response

type TokenRefreshRequest

type TokenRefreshRequest struct {
	// RefreshToken grantType==refresh_token 时需要
	RefreshToken string `json:"refresh_token,omitempty"`
}

TokenRefreshRequest 刷新Access Token API Request

func (TokenRefreshRequest) GetType

func (r TokenRefreshRequest) GetType() string

GetType implement Request interface

type TokenRefreshResponse

type TokenRefreshResponse struct {
	model.CommonResponse
	Data *Token `json:"pop_auth_token_refresh_response,omitempty" xml:"pop_auth_token_refresh_response,omitempty"`
}

TokenRefreshResponse 刷新Access Token API Response

type URLRequest

type URLRequest struct {
	// AuthType 授权类型
	AuthType AuthType `json:"auth_type"`
	// RedirectURI 已创建应用-应用详情中查看回调地址字段值,在用户完成授权后,code值将回调至该地址中。注意:redirect_uri需进行url编码(encodeURIComponent)
	RedirectURI string `json:"redirect_uri,omitempty"`
	// State 自定义参数,授权完成后,原值将回调至redirect_uri中
	State string `json:"state,omitempty"`
	// View 可选web或h5,默认为web,H5移动端网页授权必填
	View string `json:"view,omitempty"`
}

URLRequest 组装授权页URL API Request

Jump to

Keyboard shortcuts

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