-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OAuth example for python #13
base: main
Are you sure you want to change the base?
Conversation
This commit contains a cronjob example for the database-oriented structure of this OAuth example. This cronjob should be called every 10-20 days, to keep every refresh token up-to-date. Contains PHPMailer dependency if the mailer function is required by the user.
Hi, |
Hi, |
The 2 use-case we try to showcase in this repo are:
|
@Tchekda Hey David, the SSO flow part should be done, utilizing a Flask web server to listen to the callback, rest of the functions are appended to the original oauth2 file |
The OAuth file seems correct but the server part is really strange. You are storing the authorization code in a global variable which causes a lot of issues (security, multi-user, etc...) |
Hi, I agree that is not the best practice, but that was made only to demonstrate how to listen to a callback when attempting to authenticate with the SSO. I will rework it, what would be better in your opinion for this example, should I show how to store authorization codes in JSON, or put back the database handler file, and make this example database-dependent? Apart from that I wouldn't really modify the rest of the code, as this should be enough to implement basically any API interaction which needs OAuth credentials. |
My suggestion:
|
The authentication procedure is now updated: - Authorization token is now saved in browser cookies - Added new endpoints/functions to demonstrate and show the data that can be generated/displayed/used with this script - Updated example env file
Hi @Tchekda, updated the code as requested |
This PR contains an OAuth module and a database manager module.
The database module is used to store refresh tokens and retrieve them in case the OAuth request needs it.
Both modules are written for asynchronous usage and can be imported into other files.