Only for Uzbekistan
OneID integration for Flask application
pip install Flask-OneID
ONEID_LOGIN = "your login"
ONEID_PASSWORD = "your pasword"
ONEID_URL = "url from OneID" # defaul https://sso.egov.uz/sso/oauth/Authorization.do
from flask_oneid import OneID
from flask import *
def create_app():
oneid = OneID()
app = Flask(__name__)
app.config.from_pyfile('config.py')
oneid.init_app(app)
@app.route("/", methods=['GET'])
def index():
return "Hello World"
return app
app = create_app()
if __name__ == "__main__":
app.run(debug=True)
@app.route("/params", methods=['GET'])
def params():
print(request.args)
return redirect(url_for('index'))
@app.route("/params", methods=['GET'])
def params():
data = oneid.Params_To_Dict(request.args)
print(data)
return redirect(url_for('index'))
with app.test_request_context():
oneid.Set_Callback(url_for('params'))
from flask_oneid import OneID
from flask import *
def create_app():
oneid = OneID()
app = Flask(__name__)
app.config.from_pyfile('config.py')
oneid.init_app(app)
@app.route("/", methods=['GET'])
def index():
return "Hello World"
@app.route("/params", methods=['GET'])
def params():
data = oneid.Params_To_Dict(request.args)
return jsonify(data)
with app.test_request_context():
oneid.Set_Callback(url_for('params'))
return app
app = create_app()
if __name__ == "__main__":
app.run(debug=True)
After run app go to route /oneid/login
to login oneid and get data about user
Example of data in callback
{
"_pport_expr_date": "",
"_pport_issue_date": "",
"birth_date": "",
"birth_place": "",
"ctzn": "",
"email": "",
"first_name": "",
"full_name": "",
"gd": "",
"legal_info": null,
"mid_name": "",
"mob_phone_no": "",
"natn": "",
"per_adr": "",
"pin": "",
"pport_expr_date": "",
"pport_issue_date": "",
"pport_issue_place": "",
"pport_no": "",
"ret_cd": "",
"sess_id": "",
"sur_name": "",
"tin": "",
"user_id": "",
"user_type": "",
"valid": ""
}
U can use it to create user and login with Flask-Admin
This project is licensed under the MIT License (see the LICENSE
file for details).