🐛 Fixed the "url must not contain a query string" error when requesting the user from twitter API.

This error was throw by the oauth lib, we had to pass the params as a
parameter of the `Get` method.
This commit is contained in:
Soulcramer 2019-03-02 23:45:02 +01:00
parent 157a5f7487
commit d568654df1

View File

@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
"github.com/aerogo/aero"
@ -79,7 +80,8 @@ func InstallTwitterAuth(app *aero.Application) {
}
// Fetch user data from Twitter
resp, err := config.Get(nil, tokenCred, "https://api.twitter.com/1.1/account/verify_credentials.json?include_email=true&skip_status=true", nil)
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)
if err != nil {
return ctx.Error(http.StatusBadRequest, "Failed requesting user data from Twitter", err)