Browse Source

more oath

Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
tags/v0.0.11
Martyn 1 month ago
parent
commit
f7b047f8e3
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      internal/webserver/webserver.go

+ 6
- 1
internal/webserver/webserver.go View File

@@ -189,6 +189,7 @@ func twitchHTTPClient(call string, bearer string) (string, error) {
var bearerHeader = "Bearer " + bearer

req, err := http.NewRequest("GET", url, nil)
req.Header.Add("Client-ID", ircBot.AppCredentials.ClientID)
req.Header.Add("Authorization", bearerHeader)

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("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)
if err != nil {
response.WriteHeader(500)
@@ -277,6 +278,10 @@ func TwitchAdminHandler(response http.ResponseWriter, request *http.Request) {
fmt.Fprint(response, usersResponse)
fmt.Fprint(response, "\n---\n")
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
}



Loading…
Cancel
Save