more oath
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
This commit is contained in:
Martyn 2020-06-30 20:38:07 +02:00
parent 7735ca7a27
commit f7b047f8e3
1 changed files with 6 additions and 1 deletions

View File

@ -189,6 +189,7 @@ func twitchHTTPClient(call string, bearer string) (string, error) {
var bearerHeader = "Bearer " + bearer var bearerHeader = "Bearer " + bearer
req, err := http.NewRequest("GET", url, nil) req, err := http.NewRequest("GET", url, nil)
req.Header.Add("Client-ID", ircBot.AppCredentials.ClientID)
req.Header.Add("Authorization", bearerHeader) req.Header.Add("Authorization", bearerHeader)
client := &http.Client{} client := &http.Client{}
@ -222,7 +223,7 @@ func TwitchAdminHandler(response http.ResponseWriter, request *http.Request) {
} }
req.Header.Add("Client-ID", ircBot.AppCredentials.ClientID) req.Header.Add("Client-ID", ircBot.AppCredentials.ClientID)
req.Header.Add("Authorization", "Bearer "+ircBot.AppCredentials.Password) req.Header.Add("Authorization", "Bearer "+ircBot.AppCredentials.Password)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded") req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req) resp, err := http.DefaultClient.Do(req)
if err != nil { if err != nil {
response.WriteHeader(500) response.WriteHeader(500)
@ -277,6 +278,10 @@ func TwitchAdminHandler(response http.ResponseWriter, request *http.Request) {
fmt.Fprint(response, usersResponse) fmt.Fprint(response, usersResponse)
fmt.Fprint(response, "\n---\n") fmt.Fprint(response, "\n---\n")
fmt.Fprint(response, usersObject) fmt.Fprint(response, usersObject)
fmt.Fprint(response, "\n---\n")
fmt.Fprint(response, "curl -H 'Authorization: Bearer "+oauthResponse.Access_token+
"' -H 'Client-ID: "+ircBot.AppCredentials.ClientID+
" -X GET https://api.twitch.tv/users")
return return
} }