def oauth_ask_token_flow(auth_url, callback):
    ''' present the url to user and an input to paste the oauth token '''
    SublimeHelper.message('A URL has been copied to your clipboard!  Open a browser window logged in under the Google Apps account that you wish to associate with this plugin, then paste the URL from your clipboard into that browser.  Approve the request and copy the generated token back into the input box below.')
    sublime.set_clipboard(auth_url)
    def finished(code):
        result = callback(code)
        if not result:
            SublimeHelper.message("invalid OAuth code, try again :/")
        else:
            SublimeHelper.message("Authentification success!  You can now browse and edit your Google Apps Scripts files.")
        return result
    SublimeHelper.show_input("Oauth code : ", "", finished)
Пример #2
0
def oauth_ask_token_flow(auth_url, callback):
    ''' present the url to user and an input to paste the oauth token '''
    SublimeHelper.message(
        'A URL has been copied to your clipboard!  Open a browser window logged in under the Google Apps account that you wish to associate with this plugin, then paste the URL from your clipboard into that browser.  Approve the request and copy the generated token back into the input box below.'
    )
    sublime.set_clipboard(auth_url)

    def finished(code):
        result = callback(code)
        if not result:
            SublimeHelper.message("invalid OAuth code, try again :/")
        else:
            SublimeHelper.message(
                "Authentification success!  You can now browse and edit your Google Apps Scripts files."
            )
        return result

    SublimeHelper.show_input("Oauth code : ", "", finished)