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

Add option for quick connect logins #144

Merged
merged 5 commits into from
Dec 16, 2024

Conversation

twsouthwick
Copy link
Contributor

@twsouthwick twsouthwick commented Nov 10, 2024

This change reworks the login flow to first request the uri of the server, then the user selects login with password or quick connect. At that point, the existing password login flow takes over, or a new one that gets a quick connect code is used.

Server URL

image

Password

image

Quick connect (connecting)

image

Quick connect

image

As part of this change, the auth information stored by the system has been changed. Previously the password had been stored. This is probably not needed (at least basic usage shows it doesn't affect anything) since there's a refresh token there. Since both login flows provide a refresh token, we can store that instead.

@twsouthwick
Copy link
Contributor Author

I've never used flutter/dart, so please let me know if there are better patterns for anything I've done. This app seems great just can't currently log in with my normal accounts since I have OIDC set up.

This change changes the login flow to first request the uri of the server, then the user selects login with password or quick connect. At that point, the existing password login flow takes over, or a new one that gets a quick connect code is used.

As part of this change, the auth information stored by the system has been changed. Previously the password had been stored. This is probably not needed (at least basic usage shows it doesn't affect anything) since there's a refresh token there. Since both login flows provide a refresh token, we can store that instead.
@jdk-21
Copy link
Collaborator

jdk-21 commented Nov 12, 2024

Great work. I didn't get to implementing Quick Connect yet.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put the functions in a class and the file in the components folder.
The error messages should be localized too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can move the message to be localized, but I didn't write that part (I'm just refactoring to be able to use it in the quick connect flow). It's marked as "//todo PLACEHOLDER MESSAGES NOT FINAL". Thoughts?

@@ -68,6 +68,89 @@ class ApiService {
return _user!;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Login with Password still returns the password which will be saved too.
What I didn't check is, if the user gets redirected to the login after the token has expired.
And the token doesn't get to be refreshed yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted the change that just reconnects with the token to call the login if there is a password.

If the token has expired (not sure when/how that happens as it appears to be an opaque blob and not a jwt), it bubbles up as a 401 that will cause the app to error out and send you to the login

@twsouthwick twsouthwick requested a review from jdk-21 November 17, 2024 23:51
@twsouthwick
Copy link
Contributor Author

@jdk-21 anything else you need here? Any chance it come be merged and released so I can use this with deployment?

Copy link
Collaborator

@jdk-21 jdk-21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking this long to respond.
Thank you for your contribution.

@jdk-21 jdk-21 merged commit 4e3f2c5 into jellyflix-app:main Dec 16, 2024
1 check failed
@twsouthwick twsouthwick deleted the quick-connect branch December 16, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants