Google app_files and Anvil app server

Hi @gnu_B,

It turns out this is actually a missing feature in the App Server! Summary: There’s a workaround, which I describe below, and we’ll add the official solution to the next release of the App Server.

Background: In order to use App Files with your app, we must of course provide credentials that allow your app to access your Google Drive to retrieve them. This comes in the form of an OAuth Refresh Token. When you use the Anvil Editor, Anvil obtains a Refresh Token and embeds it (encrypted) into your app. If you want to use App Files with the App Server, you’ll need to acquire your own Refresh Token (using your own Google Client ID and Secret).

As of version 1.8.0 of the App Server, you can’t provide a Refresh Token in your server configuration (command line or config file). However, you can provide one in your anvil.yaml, by editing the Google service’s server_config and adding the key delegation_refresh_token: "<YOUR TOKEN HERE>".

This is a workaround, as this app will not work if you push this change back up into the Anvil platform (Anvil will attempt to use your refresh token with Anvil’s Client ID, which wont’ work). So, in the next version of the App Server, there will be a --google-refresh-token configuration variable for setting this value without editing your anvil.yaml.

1 Like