def orcid_connect(): orcid_id = get_orcid_id_from_oauth( request.json['code'], request.json['redirectUri'] ) if not orcid_id: abort_json(500, "Invalid JSON return from ORCID during OAuth.") connect_orcid(g.my_person, orcid_id) return jsonify({"token": g.my_person.get_token()})
def orcid_connect(): print u"in orcid_connect with request.json {}".format(request.json) orcid_id = get_orcid_id_from_oauth(request.json['code'], request.json['redirectUri']) if not orcid_id: print u"in orcid_login with error, no orcid_id" abort_json(500, "Invalid JSON return from ORCID during OAuth.") connect_orcid(g.my_person, orcid_id) return jsonify({"token": g.my_person.get_token()})
def orcid_login(): my_orcid_id = get_orcid_id_from_oauth( request.json['code'], request.json['redirectUri'] ) if not my_orcid_id: abort_json(401, "Bad ORCID response; the auth code you sent is probably expired.") my_person = Person.query.filter_by(orcid_id=my_orcid_id).first() if not my_person: abort_json( 404, "We don't have that ORCID in the db.", identity_provider_id=my_orcid_id ) return jsonify({"token": my_person.get_token()})
def orcid_login(): print u"in orcid_login with request.json {}".format(request.json) my_orcid_id = get_orcid_id_from_oauth(request.json['code'], request.json['redirectUri']) if not my_orcid_id: print u"in orcid_login with error, no my_orcid_id" abort_json( 401, "Bad ORCID response; the auth code you sent is probably expired.") my_person = Person.query.filter_by(orcid_id=my_orcid_id).first() if not my_person: print u"in orcid_login with error, no my_person" abort_json(404, "We don't have that ORCID in the db.", identity_provider_id=my_orcid_id) return jsonify({"token": my_person.get_token()})