Esempio n. 1
0
def authenticate():
    """
    Run OAuth workflow.
    """
    from flask import request
    response = make_response()
    context = make_context()

    result = authomatic.login(WerkzeugAdapter(request, response), 'google')

    if result:
        context['result'] = result

        if not result.error:
            save_credentials(result.user.credentials)

        return render_template('oauth/authenticate.html', **context)

    return response
Esempio n. 2
0
def authenticate():
    """
    Run OAuth workflow.
    """
    from flask import request

    response = make_response()
    context = make_context()

    result = authomatic.login(WerkzeugAdapter(request, response), "google")

    if result:
        context["result"] = result

        if not result.error:
            save_credentials(result.user.credentials)

        return render_template("oauth/authenticate.html", **context)

    return response
Esempio n. 3
0
def authenticate():
    """
    Run OAuth workflow.
    """
    from flask import request
    response = make_response()
    context = make_context()

    if not _has_api_credentials():
        return render_template('oauth/warning.html', **context)

    result = authomatic.login(WerkzeugAdapter(request, response), 'google')

    if result:
        context['result'] = result

        if not result.error:
            save_credentials(result.user.credentials)

        return render_template('oauth/authenticate.html', **context)

    return response
Esempio n. 4
0
def authenticate():
    """
    Run OAuth workflow.
    """
    from flask import request
    response = make_response()
    context = make_context()

    if not _has_api_credentials():
        return render_template('oauth/warning.html', **context)

    result = authomatic.login(WerkzeugAdapter(request, response), 'google')

    if result:
        context['result'] = result

        if not result.error:
            save_credentials(result.user.credentials)
            get_document(app_config.COPY_GOOGLE_DOC_KEY, app_config.COPY_PATH)

        return render_template('oauth/authenticate.html', **context)

    return response
Esempio n. 5
0
def authenticate():
    """
    Run OAuth workflow.
    """
    from flask import request
    response = make_response()
    context = make_context()

    if not _has_api_credentials():
        return render_template('warning.html', **context)

    result = authomatic.login(WerkzeugAdapter(request, response), 'google')

    if result:
        context['result'] = result

        if not result.error:
            save_credentials(result.user.credentials)
            get_spreadsheet(app_config.COPY_GOOGLE_DOC_KEY, app_config.COPY_PATH)

        return render_template('authenticate.html', **context)

    return response