Documentation
¶
Overview ¶
Package loginv2 provides the REST AuthN v2 explicit login client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthMethod ¶
type AuthMethod string
AuthMethod is the explicit REST AuthN v2 login method.
const ( AuthMethodPassword AuthMethod = "password" AuthMethodPhoneOTP AuthMethod = "phone_otp" AuthMethodWechat AuthMethod = "wechat" AuthMethodWecom AuthMethod = "wecom" )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client calls the REST AuthN v2 login endpoint.
type LoginRequest ¶
type LoginRequest struct {
AuthMethod AuthMethod `json:"auth_method"`
MethodPayload any `json:"method_payload"`
DeviceID string `json:"device_id,omitempty"`
}
LoginRequest is the REST AuthN v2 login request.
func (LoginRequest) Validate ¶
func (r LoginRequest) Validate() error
Validate checks only the public REST v2 contract boundary.
type Option ¶
type Option func(*Client)
Option customizes the REST AuthN v2 login client.
func WithHTTPClient ¶
WithHTTPClient sets the HTTP client used for requests.
func WithHeader ¶
WithHeader adds a static header to every request.
type PasswordPayload ¶
type PasswordPayload struct {
Username string `json:"username"`
Password string `json:"password"`
TenantID uint64 `json:"tenant_id,omitempty"`
}
PasswordPayload is the password login payload.
type PhoneOTPPayload ¶
PhoneOTPPayload is the phone OTP login payload.
type TokenPair ¶
type TokenPair struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresIn int64 `json:"expires_in"`
RefreshToken string `json:"refresh_token,omitempty"`
}
TokenPair is the successful login token pair.
type WechatPayload ¶
WechatPayload is the WeChat mini program login payload.
type WecomPayload ¶
WecomPayload is the WeCom login payload.