rio-labs / rio

WebApps in pure Python. No JavaScript, HTML and CSS needed
https://rio.dev
Apache License 2.0
1.19k stars 32 forks source link

[Feature Request] support external Oauth2 and OpenID connect server #146

Open YoranSys opened 3 days ago

YoranSys commented 3 days ago

Description

Modern sites or apps need to provide social login based on OAuth 2.0 code flow. In the context of rio and OAuth 2.0, the PKCE code flow can be used at the frontend and token validation on the backend side.

Good starting point for OAuth2.0: https://dev.to/hem/oauth-2-0-flows-explained-in-gifs-2o7a

Suggested Solution

Maybe based on :

Alternatives

No response

Additional Context

No response

Related Issues/Pull Requests

No response

mad-moo commented 1 day ago

Hey

The next version of Rio will ship with an example of how to implement authentication (https://github.com/rio-labs/rio/tree/main/rio/snippets/snippet-files/project-template-Authentication). This is using classical, locally stored usernames/passwords rather than OAuth, but it shows the gist of authentication. My question is, what prevents us from just extending this to also include OAuth. I don't see what Rio itself needs to support to enable this.

Need some js file for automatic token refresh

Can you expand on that? I was thinking of refreshing the token whenever a user starts a new session, or maybe when they switch pages or any other frequent (but not too frequent) action.

mad-moo commented 1 day ago

@Sn3llius might be interesting for you to also watch this issue, given that you've implemented the authentication example