                             log "ERROR: File #{path} not found on Dropbox."
                             history.pushState(null, null, "#BLANK")
                         else
-                            if dbx.accessToken?
+                            ensureDropboxToken(path).then () ->
                                 log "ERROR: #{error.error} (Status: #{error.status})"
                                 history.pushState(null, null, "#BLANK")
-                            else
-                                slog 'Redirect:'
-                                slog authenticationUrl
-                                window.location = authenticationUrl
 
 
 

# To temporarily introspect variables during development.
spy = window
slog = console.log # spy + log

import { DockPanel }                 from 'phosphor-dockpanel'
import { CodeMirrorWidget }          from 'phosphor-codemirror'

    expose.amplify = amplify

    spy.parseQueryString = parseQueryString
    spy.ensureDropboxToken = ensureDropboxToken

    spy.coffeeconsole = coffeeconsole
    spy.hashKeys = hashKeys
