Search code examples
google-app-enginedjango-rest-frameworkoauthgoogle-cloud-functionsjwt

Oauth for authorization JWT for authentication for an app using DRF and cloud functions


I'm building a web app with Wagtail as back-end, running on app engine, cloud functions doing micro-services and triggered via http. I want to let my users register and authorize using social apps and classic login-password and get a JWT token from Wagtail App. Then, the token will be used to authenticate users both on cloud functions and Wagtail back-end. How do I provide the user with JWT tokens if he/she authorizes with OAuth? Is my approach correct? Any suggestions on how this should be done in the proper way?


Solution

  • The best solution I found so far is to use firebase auth. In python I verify token like that:

    from firebase_admin import auth
    
    decoded_token = auth.verify_id_token(id_token)
    uid = decoded_token['uid']