Exemple #1
0
def twitter_connect():
    twitter_creds = get_twitter_creds(
        request.json.get('oauth_token'),
        request.json.get('oauth_verifier')
    )

    connect_twitter(g.my_person, twitter_creds)
    return jsonify({"token": g.my_person.get_token()})
Exemple #2
0
def twitter_connect():
    twitter_creds = get_twitter_creds(
        request.json.get('oauth_token'),
        request.json.get('oauth_verifier')
    )

    connect_twitter(g.my_person, twitter_creds)
    return jsonify({"token": g.my_person.get_token()})
Exemple #3
0
def twitter_register_but_login_if_they_are_already_registered():
    twitter_creds = get_twitter_creds(request.json.get('oauth_token'), request.json.get('oauth_verifier'))
    if not twitter_creds:
        print u"error in twitter_register_but_login_if_they_are_already_registered, empty twitter creds"
        abort_json(422, "empty twitter creds")

    try:
        my_person = make_person(twitter_creds)
    except PersonExistsException:
        my_person = Person.query.filter_by(twitter=twitter_creds["screen_name"]).first()

    return jsonify({"token": my_person.get_token()})
Exemple #4
0
def twitter_register_but_login_if_they_are_already_registered():
    twitter_creds = get_twitter_creds(request.json.get('oauth_token'), request.json.get('oauth_verifier'))
    landing_page = request.json.get("customLandingPage", "default")
    if not twitter_creds:
        print u"error in twitter_register_but_login_if_they_are_already_registered, empty twitter creds"
        abort_json(422, "empty twitter creds")

    try:
        my_person = make_person(twitter_creds, landing_page=landing_page)
    except PersonExistsException:
        my_person = Person.query.filter_by(twitter=twitter_creds["screen_name"]).first()

    return jsonify({"token": my_person.get_token()})
def twitter_login():
    twitter_creds = get_twitter_creds(request.json.get('oauth_token'),
                                      request.json.get('oauth_verifier'))
    if not twitter_creds:
        print u"error in twitter_login, empty twitter creds"
        abort_json(422, "empty twitter creds")

    my_person = Person.query.filter_by(
        twitter=twitter_creds["screen_name"]).first()
    if not my_person:
        abort_json(404,
                   "We don't have that Twitter in the db.",
                   identity_provider_id=twitter_creds["screen_name"])

    return jsonify({"token": my_person.get_token()})
Exemple #6
0
def twitter_login():
    twitter_creds = get_twitter_creds(request.json.get('oauth_token'), request.json.get('oauth_verifier'))
    if not twitter_creds:
        print u"error in twitter_login, empty twitter creds"
        abort_json(422, "empty twitter creds")

    my_person = Person.query.filter_by(twitter=twitter_creds["screen_name"]).first()
    if not my_person:
        abort_json(
            404,
            "We don't have that Twitter in the db.",
            identity_provider_id=twitter_creds["screen_name"]
        )

    return jsonify({"token": my_person.get_token()})