0

I have create Google app engine project which using Prediction Api 1.5v.It work fine for me when i run it on local mean localhost:8888 using Google o2Auth Authentication with client id and client secret.but when i have run it live the it will given a error as

java.security.AccessControlException: access denied ("java.io.FilePermission" "/base/data/home/apps/s~charn-project/1.369216781240579013/.credentials" "write")

My code of o2auth is as

GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(Database.class.getResourceAsStream("/client_secrets.json"))); System.out.println("cl"+clientSecrets.getDetails().getClientSecret());

    if (clientSecrets.getDetails().getClientId().startsWith("Enter")
            || clientSecrets.getDetails().getClientSecret().startsWith("Enter ")) {

        System.out.println(
              "Enter Client ID and Secret from https://code.google.com/apis/console/?api=prediction "
              + "into prediction-cmdline-sample/src/main/resources/client_secrets.json");
          System.exit(1);
        }
        // set up file credential store
       FileCredentialStore credentialStore = new FileCredentialStore(
            new File(System.getProperty("user.home"), ".credentials/prediction.json"), JSON_FACTORY);
        // set up authorization code flow
       System.out.println("cre"+credentialStore);
       GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
            httpTransport, JSON_FACTORY, clientSecrets,
            Collections.singleton(PredictionScopes.PREDICTION)).setCredentialStore(credentialStore)
            .build();

        // authorize
        return new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");

May be problem is in this line

FileCredentialStore credentialStore = new FileCredentialStore( new File(System.getProperty("user.home"), ".credentials/prediction.json"), JSON_FACTORY);

Charnjeet Singh
  • 3,056
  • 6
  • 35
  • 65

1 Answers1

0

Writing to files is not currently supported in app engine.

Source: https://developers.google.com/appengine/kb/java?csw=1#writefile

The high replication data store (HRD) is fairly easy to use and even easier with projects like Objectify (https://code.google.com/p/objectify-appengine/). I would suggest checking that out.

sbsmith
  • 600
  • 1
  • 5
  • 16