第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

golang google oauth2 - 無(wú)法獲取用戶(hù)信息

golang google oauth2 - 無(wú)法獲取用戶(hù)信息

Go
有只小跳蛙 2021-09-10 15:13:40
我正在為 google oauth2 https://github.com/golang/oauth2使用以下庫(kù)我正在使用示例中給出的代碼(網(wǎng)址:http : //play.golang.org/p/qXyuaVEhyS,https : //godoc.org/golang.org/x/oauth2/google)我能夠獲取授權(quán)碼和令牌,但無(wú)法發(fā)出獲取用戶(hù)信息的請(qǐng)求我的代碼:conf := &oauth2.Config{        ClientID:     "my client id",        ClientSecret: "secred id",        RedirectURL:  "http://localhost:3000/googlelogin",        Scopes: []string{            "https://www.googleapis.com/auth/userinfo.profile",        },        Endpoint: google.Endpoint,    }m.Get("/googleloginrequest", func(r render.Render, request *http.Request) {    url := conf.AuthCodeURL("state")    fmt.Printf("Visit the URL for the auth dialog: %v", url)    r.Redirect(url)})m.Get("/googlelogin", func(r render.Render, request *http.Request) {        authcode := request.FormValue("code")        tok, err := conf.Exchange(oauth2.NoContext, authcode)        if err != nil {            log.Fatal(err)        }        client := conf.Client(oauth2.NoContext, tok)        resp, err :=client.Get("https://www.googleapis.com/userinfo/v2/me")        r.JSON(200, map[string]interface{}{"status":resp})    })我在這里得到的回應(yīng)非常大而且沒(méi)有任何用戶(hù)信息
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 358 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)