Skip to content

Commit

Permalink
fix: use setAppId
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoehnelt authored Sep 19, 2024
1 parent 3d7d7f7 commit a0ada3f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions picker/dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
<script>
// IMPORTANT: Replace the value for DEVELOPER_KEY with the API key obtained
// from the Google Developers Console.
var DEVELOPER_KEY = 'ABC123 ... ';
var DIALOG_DIMENSIONS = {width: 600, height: 425};
var pickerApiLoaded = false;
const DEVELOPER_KEY = 'AIza...';
const CLOUD_PROJECT_NUMBER = '1234567890';
const DIALOG_DIMENSIONS = {width: 600, height: 425};
let pickerApiLoaded = false;

/**
* Loads the Google Picker API.
Expand Down Expand Up @@ -53,7 +54,7 @@
*/
function createPicker(token) {
if (pickerApiLoaded && token) {
var picker = new google.picker.PickerBuilder()
const picker = new google.picker.PickerBuilder()
// Instruct Picker to display only spreadsheets in Drive. For other
// views, see https://developers.google.com/picker/docs/#otherviews
.addView(google.picker.ViewId.SPREADSHEETS)
Expand All @@ -63,6 +64,7 @@
.hideTitleBar()
.setOAuthToken(token)
.setDeveloperKey(DEVELOPER_KEY)
.setAppId(CLOUD_PROJECT_NUMBER)
.setCallback(pickerCallback)
.setOrigin(google.script.host.origin)
// Instruct Picker to fill the dialog, minus 2 pixels for the border.
Expand All @@ -83,7 +85,7 @@
* @param {object} data The response object.
*/
function pickerCallback(data) {
var action = data[google.picker.Response.ACTION];
const action = data[google.picker.Response.ACTION];
if (action == google.picker.Action.PICKED) {
var doc = data[google.picker.Response.DOCUMENTS][0];
var id = doc[google.picker.Document.ID];
Expand Down

0 comments on commit a0ada3f

Please sign in to comment.