       callback "Google API (global 'gapi' object) not found.  See: https://developers.google.com/drive/v3/web/quickstart/js"
 
     defaults args,
-      scope: 'https://www.googleapis.com/auth/drive'
+      scope: 'https://www.googleapis.com/auth/drive.readonly'
       immediate: true
 
     gapi.auth.authorize args, (authResult) => @handleAuthResult(authResult, args, callback)


  addMetadata: (files) ->
    for file in files
      if file.id? and not file.viewUrl?
        file.viewUrl ?= "http://drive.google.com/uc?export=view&id=#{file.id}"
      if file.id? and not file.downloadUrl?
        file.downloadUrl ?= "http://drive.google.com/uc?export=download&id=#{file.id}"
      if file.id? and file.mimeType.startsWith('image/') and not file.thumbnailUrl?
        file.thumbnailUrl ?= "https://drive.google.com/thumbnail?authuser=0&sz=w320&id=#{file.id}"

  toSphere: (rootNodeId, files) =>
    sphere = new Sphere

        end: sphere.addNode(file)
    sphere

  getFiles: (filter, allFiles=[], nextPageToken=null) ->
    gapi.client.request
      path: "drive/v3/files"
      params:
        q: filter
        pageToken: nextPageToken
        fields: 'files,kind,nextPageToken'
        pageSize: 1000
    .then (response) =>
      {result: {files, nextPageToken}} = response
      allFiles.push files...
      if nextPageToken
        @getFiles filter, allFiles, nextPageToken
      else
        allFiles

  # ####################################################################
  # # Filename utilities
