feat: complete auth
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package wechat
|
||||
|
||||
import "github.com/imroc/req/v3"
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
"github.com/imroc/req/v3"
|
||||
)
|
||||
|
||||
type Options func(*Client)
|
||||
|
||||
@@ -37,3 +41,29 @@ func WithClient(client *req.Client) Options {
|
||||
we.client = client
|
||||
}
|
||||
}
|
||||
|
||||
type ScopeAuthorizeURLOptions func(url.Values)
|
||||
|
||||
func ScopeAuthorizeURLWithScope(scope AuthScope) ScopeAuthorizeURLOptions {
|
||||
return func(v url.Values) {
|
||||
v.Set("scope", scope.String())
|
||||
}
|
||||
}
|
||||
|
||||
func ScopeAuthorizeURLWithRedirectURI(uri string) ScopeAuthorizeURLOptions {
|
||||
return func(v url.Values) {
|
||||
v.Set("redirect_uri", uri)
|
||||
}
|
||||
}
|
||||
|
||||
func ScopeAuthorizeURLWithState(state string) ScopeAuthorizeURLOptions {
|
||||
return func(v url.Values) {
|
||||
v.Set("state", state)
|
||||
}
|
||||
}
|
||||
|
||||
func ScopeAuthorizeURLWithForcePopup() ScopeAuthorizeURLOptions {
|
||||
return func(v url.Values) {
|
||||
v.Set("forcePopup", "true")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user