Skip to content
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

[Feature Request] Allow user create token by themself #9

Closed
EkkoG opened this issue Dec 8, 2023 · 3 comments · Fixed by #16
Closed

[Feature Request] Allow user create token by themself #9

EkkoG opened this issue Dec 8, 2023 · 3 comments · Fixed by #16
Labels
enhancement New feature or request

Comments

@EkkoG
Copy link
Contributor

EkkoG commented Dec 8, 2023

As #6 (comment) say, for now user can not create a token by themself

Add route /login, return a simple a tag page, click the a tag will open a GitHub auth URL with client_id https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#redirect-urls
Add route /loigin_redirect to receive the callback of URL from GitHub with code, after server receive the request, it can get a GitHub access token with the code https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#2-users-are-redirected-back-to-your-site-by-github

Get GitHub user id with the access token, create a user and return the user token.

I try to add a route at user.rs, it will protect by the auth system, I'm not familiar with Rust and Actix-Web, so for now I need to learn many things to imp the idea.

@Clem-Fern
Copy link
Owner

I was thinking about this too! It was my next step in my todo list.

Adding this feature would need to store users in database instead of in memory. Do you think local users and external users should coexist ?

I think a good way to implement this would be to add an env var like RTABBY_USERS_PROVIDER and then let admin decides between local and oauth.

@Clem-Fern Clem-Fern added the enhancement New feature or request label Dec 8, 2023
@EkkoG EkkoG mentioned this issue Dec 9, 2023
9 tasks
@EkkoG
Copy link
Contributor Author

EkkoG commented Dec 22, 2023

I have created a PR implement both of the two auth method. Please review my pull request when you have time.

@Clem-Fern
Copy link
Owner

Hey @EkkoG,

I finally got the time to merge this feature. I reworked it a bit to only publish login endpoint when oauth provider is configured.

Thank's again for your work ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants