Marlhex
Marlhex

Reputation: 1979

How to grant read access to a ServiceAccount

How to double check the read access for the Json file

I want to double check or consider another ways to set up the privileges that I have for this file.

I've already tried IAM (Identity and Access Management) admin privileges (It has Editor privileges) & I'm using GAE (Google App Engine) with Firebase Admin (It supposed to doesn't matter the Firebase Rules for the full privileges case).

I also have my file under /WEB-INF/.

This is the error on the StackDriver

java.security.AccessControlException: access denied ("java.io.FilePermission" "/WEB-INF/project-blah-firebase-adminsdk-blah-blah.json" "read")

Additional notes

  1. I have tried the code on the Post and Get Method of a Servlet Class
  2. I have tried getApplicationDefault()
  3. Should I consider OAuth 2.0? if yes, where should I place the Application ID?

Additional Reference

https://cloud.google.com/solutions/mobile/firebase-app-engine-android-studio?authuser=1#adding_firebase_iam_permissions_for_the_service_account

Upvotes: 0

Views: 53

Answers (1)

Hiranya Jayathilaka
Hiranya Jayathilaka

Reputation: 7438

I have a similar GAE project where I use Maven to manage/deploy my project. Here's what I do:

  1. Put the json file into the src/main/resources directory.
  2. Load the file as follows:

InputStream stream = getClass().getClassLoader().getResourceAsStream("service_account.json");

Upvotes: 0

Related Questions