Forum Discussion
gnunez06
4 years agoHonored Guest
Making GET subscription API call with Golang http wrapper client
I am trying to make a GET subscription API call using a simple Go program. However, it's not working as expected.
package main
import (
"net/http"
"strings"
"log"
"io/ioutil"
)
func main() {
x := "access_token=OC|<redacted>|<redacted>"
body := strings.NewReader(x)
req, err := http.NewRequest(
"GET",
"https://graph.oculus.com/application/subscriptions",
body,
)
if err != nil {
// handle err
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
// handle err
}
defer resp.Body.Close()
respBody, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal(err)
}
log.Println(string(respBody))
}
Error that I see:
2022/02/09 16:43:16 {"error":{"message":"Invalid OAuth 2.0 Access Token","type":"OCApiException","code":190,"error_data":{},"fbtrace_id":"AUtKko-oyk08x89VogGw-2_"}}
I can make the request through curl successfully, as pointed out in the example here (https://developer.oculus.com/documentation/native/ps-subscriptions-s2s/)
No RepliesBe the first to reply
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 23 days ago