React front end with python back end Authentication

Hi All,

I am new to implementing Okta. I have a React JS front end and a Python (Flask) back end server. Struggling with Using Python as the authentication. Is there any Documentation around with how to do this.

Happy to supply more details.

Thanks in Advanced Aidan

Hi Aidand,

To successfully implement authentication for your React JS frontend and Python Flask backend, follow this architecture:

For React JS: Configure your Single Page Application (SPA) to redirect users to the Okta hosted login page. Use the OIDC Authorization Code Flow to set up Okta with your React app by following this documentation: [Okta OIDC Authorization Code Flow for React]

For Python Flask: Validate the tokens sent by the frontend and return a success/failure response based on the validation outcome. Follow this guide to validate the access tokens: [Validating Access Tokens in Python]

Let me know if you have any questions.

Thank you.

Appreciate the reply, I will look at these documents, Thank you Aidan

1 Like

Hi SitaRam, I have created my Okta Dev account before I go live with my company’s Okta.
I have been in contact with my identity group, they have advised that my app needs to be web application with server side authentication, do you have any suggestions around this type. Would still be React front end but would prefer to use python, as I am already using python for getting data from MySQL database. Thanks again for your help so far

@aidand

Yes, you can acheive this without React Frontend and implement a flask web application + Okta hosted login.

The below code should use authorization code flow for authenticating users.

Github: samples-python-flask/okta-hosted-login at master · okta/samples-python-flask · GitHub