Improved code readability
This commit is contained in:
parent
c42b66bdcc
commit
44f3354729
@ -77,14 +77,14 @@ func InstallFacebookAuth(app *aero.Application) {
|
||||
client := config.Client(context.Background(), token)
|
||||
|
||||
// Fetch user data from Facebook
|
||||
resp, err := client.Get("https://graph.facebook.com/me?fields=email,first_name,last_name,gender")
|
||||
response, err := client.Get("https://graph.facebook.com/me?fields=email,first_name,last_name,gender")
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusBadRequest, "Failed requesting user data from Facebook", err)
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
defer response.Body.Close()
|
||||
body, _ := ioutil.ReadAll(response.Body)
|
||||
|
||||
// Construct a FacebookUser object
|
||||
fbUser := FacebookUser{}
|
||||
|
@ -84,14 +84,14 @@ func InstallGoogleAuth(app *aero.Application) {
|
||||
client := config.Client(context.Background(), token)
|
||||
|
||||
// Fetch user data from Google
|
||||
resp, err := client.Get("https://www.googleapis.com/oauth2/v3/userinfo")
|
||||
response, err := client.Get("https://www.googleapis.com/oauth2/v3/userinfo")
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusBadRequest, "Failed requesting user data from Google", err)
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
data, _ := ioutil.ReadAll(resp.Body)
|
||||
defer response.Body.Close()
|
||||
data, _ := ioutil.ReadAll(response.Body)
|
||||
|
||||
// Construct a GoogleUser object
|
||||
var googleUser GoogleUser
|
||||
|
@ -80,15 +80,19 @@ func InstallTwitterAuth(app *aero.Application) {
|
||||
}
|
||||
|
||||
// Fetch user data from Twitter
|
||||
params := url.Values{"include_email": {"true"}, "skip_status": {"true"}}
|
||||
resp, err := config.Get(nil, tokenCred, "https://api.twitter.com/1.1/account/verify_credentials.json", params)
|
||||
params := url.Values{
|
||||
"include_email": {"true"},
|
||||
"skip_status": {"true"},
|
||||
}
|
||||
|
||||
response, err := config.Get(nil, tokenCred, "https://api.twitter.com/1.1/account/verify_credentials.json", params)
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusBadRequest, "Failed requesting user data from Twitter", err)
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
defer response.Body.Close()
|
||||
body, _ := ioutil.ReadAll(response.Body)
|
||||
|
||||
// Construct a TwitterUser object
|
||||
twUser := TwitterUser{}
|
||||
|
Loading…
Reference in New Issue
Block a user