We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// 1. Get Authorization Code func GetAuthCode(w http.ResponseWriter, r *http.Request) {
params := url.Values{} params.Add("response_type", "code") params.Add("client_id", AppId) params.Add("state", "test") str := fmt.Sprintf("%s&redirect_uri=%s", params.Encode(), redirectURI) loginURL := fmt.Sprintf("%s?%s", "https://graph.qq.com/oauth2.0/authorize", str) http.Redirect(w, r, loginURL, http.StatusOK) fmt.Println("Login successful")
}
// 2. Get Access Token func GetToken(w http.ResponseWriter, r *http.Request) { fmt.Println("Getting") code := r.FormValue("code") params := url.Values{} params.Add("grant_type", "authorization_code") params.Add("client_id", AppId) params.Add("client_secret", AppKey) params.Add("code", code) str := fmt.Sprintf("%s&redirect_uri=%s", params.Encode(), redirectURI) loginURL := fmt.Sprintf("%s?%s", "https://graph.qq.com/oauth2.0/token", str)
response, err := http.Get(loginURL) if err != nil { w.Write([]byte(err.Error())) } defer response.Body.Close() bs, _ := ioutil.ReadAll(response.Body) body := string(bs) resultMap := convertToMap(body) info := &PrivateInfo{} info.AccessToken = resultMap["access_token"] info.RefreshToken = resultMap["refresh_token"] info.ExpiresIn = resultMap["expires_in"] GetOpenId(info, w)
}gin框架接入的时候为什么没有扫码的页面
The text was updated successfully, but these errors were encountered:
No branches or pull requests
// 1. Get Authorization Code
func GetAuthCode(w http.ResponseWriter, r *http.Request) {
}
// 2. Get Access Token
func GetToken(w http.ResponseWriter, r *http.Request) {
fmt.Println("Getting")
code := r.FormValue("code")
params := url.Values{}
params.Add("grant_type", "authorization_code")
params.Add("client_id", AppId)
params.Add("client_secret", AppKey)
params.Add("code", code)
str := fmt.Sprintf("%s&redirect_uri=%s", params.Encode(), redirectURI)
loginURL := fmt.Sprintf("%s?%s", "https://graph.qq.com/oauth2.0/token", str)
}gin框架接入的时候为什么没有扫码的页面
The text was updated successfully, but these errors were encountered: