Flask-OneID
Only for Uzbekistan
OneID integration for Flask application
Links
How it Works
Install
pip install Flask-OneID
Add your credentials from OneID to config file
ONEID_LOGIN = "your login"
ONEID_PASSWORD = "your pasword"
ONEID_URL = "url from OneID" # defaul https://sso.egov.uz/sso/oauth/Authorization.do
Create Flask App With OneID
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)
Add route to catch data from OneId
@app.route("/params", methods=['GET'])
def params():
print(request.args)
return redirect(url_for('index'))
Use builtin function to convert request args to dict
@app.route("/params", methods=['GET'])
def params():
data = oneid.Params_To_Dict(request.args)
print(data)
return redirect(url_for('index'))
Register your Callback Url for OneID module
with app.test_request_context():
oneid.Set_Callback(url_for('params'))
Full Code
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)
OneID route
After run app go to route /oneid/login to login oneid and get data about user
Return data
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
License
This project is licensed under the MIT License (see the LICENSE file for details).
Metadata
Release files for Flask-OneID 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Flask-OneID-1.0.3.tar.gz | 5.1 kB | Without provenance | Details for Flask-OneID-1.0.3.tar.gz |
Release files / Flask-OneID-1.0.3.tar.gz
| Download URL | Flask-OneID-1.0.3.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7fc980db0962537de0d14178e9018cb107dccf1f03a63585234cbd7a04475117
|
|
BLAKE2b-256 checksum How to use checksums |
a6c500e34af289ac7a8399e26137041c01494b8d5ec18b6abfc9e6314e03c2dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|
Security for Flask-OneID 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.