I am not sure I understand what you have done completely, but let me give it a shot at the point where you ask how to validate a jwt token.
The IDP that created the JWT token will sign the JWT token.
So you need to send the token e.g. via POST to web2py and then use pyjwt
to verify the token with however means that token was signed.
Maybe a simple passphrase, shared key, public key etc.
Once you verified the signature you can use pyjwt
to load the contents of the token into a python dict.
Some IDPs include information about the person loggin in as "claims".
Info such as First Name, Last Name, Email, Username/Displayname etc. you can extract those information
and create the user in web2py and log the user in with a web2py session.
Some IDPs do not put anything in the token and ask you to use the jwt token to call a userinfo endpoint (restful api of the IDP),
to extract more info about the user directly from the IDP instead of from the token.
The token usually was issued with certian scopes e.g. openid, profile, email and depending on the scopes of the token, the IDP will either
give this information or not.
Usually you also have to whitelist in the IDP from which hosts such a call can come from and which hosts can actually obtain tokens etc.