When using SSO Self-Service Provisioner
for single sign-on, ibm-sso
can make your work easier.
Currently only supports fastapi applications.
pip install ibm-sso
-
Add
ibm-sso
torequirements.txt
ibm-sso==0.1.1
For versions above
0.1.0
,code
andstate
are returned after successful authentication. You need to use thecode
andstate
to obtain token information.For versions lower than
0.1.0
, thetoken
is returned directly after successful authentication. Since thetoken
is returned as thequery param
of the callback, there are security risks. Versions higher than0.1.0
are recommended. -
Install
ibm-sso
fromrequirements.txt
filepipenv install -r requirements.txt
-
Set environment variables
Refer to the .env.template in the sample directory.
-
Import
ibm-sso
in startup fileRefer to the app.py in the sample directory.
-
Protect your API
If your API requires authentication to access, you can refer to sample.py
There is a full sample in the sample
directory that can be run directly. You can start from the sample to learn how to use ibm-sso.
-
Deploy project
# https://test.pypi.org/ expect interactive_deploy_test.expect # https://pypi.org/ # expect interactive_deploy.expect
-
Use
test.pypi.org
pipenv install -i https://test.pypi.org/simple/ ibm-sso