Unable to Access API From Google Cloud

So, I have written a program in Java that uses Discourse’s API, the program works as expected locally but the second I try running it from my Google Cloud Compute my API requests that were working flawlessly are now returning {"error_type":"invalid_access","errors":["You are not permitted to view the requested resource."]} and I don’t know why. My only guess so far is some setting that is blocking the API key, but I have no idea. Any suggestions?

1 Like

My guess is that you’re not passing the API key properly.

1 Like

Hmm, I’m passing it via a header, and it’s working when I run it locally. Maybe it could have something to do with a difference in my curl on Windows vs on Linux.

1 Like

Yeah. It’ll be something silly like end of line encoding or slash vs backslash. I feel your pain.

Maybe make a new api key.

2 Likes

Yeah, I just ditched using CURL and used a library for it - live and learn, I guess. Thank you for the help though.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.