# Unable to Access API From Google Cloud

**URL:** https://meta.discourse.org/t/unable-to-access-api-from-google-cloud/197492
**Category:** Support
**Created:** [July 18, 2021, 1:30am UTC](https://meta.discourse.org/t/unable-to-access-api-from-google-cloud/197492 "2021-07-18T01:30:41Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![cookieman768](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cookieman768/32/118511_2.png) [@cookieman768](https://meta.discourse.org/u/cookieman768)
#### Post date: [July 18, 2021, 1:30am UTC](https://meta.discourse.org/t/unable-to-access-api-from-google-cloud/197492/1 "2021-07-18T01:30:41Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [July 18, 2021, 2:12am UTC](https://meta.discourse.org/t/unable-to-access-api-from-google-cloud/197492/2 "2021-07-18T02:12:10Z")

</div>

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

---

<div class="post-metadata">

### Author: ![cookieman768](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cookieman768/32/118511_2.png) [@cookieman768](https://meta.discourse.org/u/cookieman768)
#### Post date: [July 18, 2021, 2:40am UTC](https://meta.discourse.org/t/unable-to-access-api-from-google-cloud/197492/3 "2021-07-18T02:40:32Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [July 18, 2021, 4:06am UTC](https://meta.discourse.org/t/unable-to-access-api-from-google-cloud/197492/4 "2021-07-18T04:06:29Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cookieman768](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cookieman768/32/118511_2.png) [@cookieman768](https://meta.discourse.org/u/cookieman768)
#### Post date: [July 18, 2021, 6:21am UTC](https://meta.discourse.org/t/unable-to-access-api-from-google-cloud/197492/5 "2021-07-18T06:21:10Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [August 17, 2021, 6:21am UTC](https://meta.discourse.org/t/unable-to-access-api-from-google-cloud/197492/6 "2021-08-17T06:21:24Z")

</div>

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