github.com/bububa/oceanengine/marketing-api@v0.0.0-20210315120513-0b953137f7a6/api/oauth/url.go (about) 1 package oauth 2 3 import ( 4 "fmt" 5 "net/url" 6 7 "github.com/bububa/oceanengine/marketing-api/core" 8 ) 9 10 // 生成授权链接 11 func Url(clt *core.SDKClient, redirectUrl string, state string) string { 12 values := &url.Values{} 13 values.Set("app_id", clt.AppID) 14 if state != "" { 15 values.Set("state", state) 16 } 17 values.Set("redirect_url", redirectUrl) 18 return fmt.Sprintf("%s?%s", core.BASE_URL, values.Encode()) 19 }