This commit is contained in:
iyear 2020-03-27 21:45:36 +08:00
parent f8c3e84ba8
commit 92145684d7

View File

@ -17,6 +17,7 @@ const (
var ( var (
cliid string cliid string
rediuri string rediuri string
scope string
) )
func init() { func init() {
@ -28,12 +29,15 @@ func init() {
} }
cliid = viper.GetString("client_id") cliid = viper.GetString("client_id")
rediuri = viper.GetString("redirect_uri") rediuri = viper.GetString("redirect_uri")
scope = viper.GetString("scope")
//refreshtoken := "xxxx" //refreshtoken := "xxxx"
//fmt.Println(MSGetUserInfo(MSGetToken(refreshtoken,"user.read mail.read"))) //fmt.Println(MSGetUserInfo(MSGetToken(refreshtoken,"user.read mail.read")))
//code := "xxx"
//fmt.Println(MSFirGetToken(code))
} }
//return access_token and refresh_token //return access_token and refresh_token
func MSFirGetToken(code, scope string) (access string, refresh string) { func MSFirGetToken(code string) (access string, refresh string) {
var r http.Request var r http.Request
client := &http.Client{} client := &http.Client{}
r.ParseForm() r.ParseForm()
@ -59,7 +63,7 @@ func MSFirGetToken(code, scope string) (access string, refresh string) {
} }
//return access_token //return access_token
func MSGetToken(refreshtoken, scope string) (access string) { func MSGetToken(refreshtoken string) (access string) {
var r http.Request var r http.Request
client := &http.Client{} client := &http.Client{}
r.ParseForm() r.ParseForm()