Skip to content

If OAuth fails, redirect to a useful error page #454

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

Closed
nerdalert opened this issue Jan 3, 2025 · 10 comments · Fixed by #674
Closed

If OAuth fails, redirect to a useful error page #454

nerdalert opened this issue Jan 3, 2025 · 10 comments · Fixed by #674
Assignees
Labels
help wanted Extra attention is needed

Comments

@nerdalert
Copy link
Member

Currently the token on ui SaaS has expired and it redirects to a 404. You can replicate the behavior by putting in a bogus Github token in the .env.

Here are client logs:

GET http://localhost:3000/error?error=AccessDenied 404 (Not Found)Understand this errorAI
Navigated to http://localhost:3000/error?error=AccessDenied

Here are server logs:

2025-01-03T21:53:14.104Z error: Error fetching GitHub organization membership for user nerdalert: Request failed with status code 401
 GET /api/auth/callback/github?code=xxxxxxxxxx&state=S-nZhFRwRPIH94q1uuS5Q 302 in 979ms
 GET /api/auth/error?error=AccessDenied 302 in 7ms
 GET /error?error=AccessDenied 404 in 19ms

@elkielki
Copy link
Collaborator

elkielki commented Mar 3, 2025

@nerdalert @vishnoianil Hi, I created a simple error page, but I’m not sure if it’s designed in the most useful way. Are there any details that you think I should add in particular to make the error page more useful?

If not, would it make sense to create a pull request as-is, so someone with more UX experience can refine it? Or would it be better to hold off for now?
Image

@vishnoianil
Copy link
Member

@Misjohns Can you please review this new error page and provide you suggestion. The page is to display any error that is encountered during the login process. Currently it's shows very basic web page with error message. @elkielki has a design proposal above for the new error page. If you have any suggestion please share, so @elkielki can take those in consideration.

Image

@Misjohns
Copy link
Collaborator

Misjohns commented Mar 4, 2025

@vishnoianil Should the text reflect the standard 404 not found or do we know the actual error, GH token invalid?

@Misjohns
Copy link
Collaborator

Misjohns commented Mar 4, 2025

@vishnoianil If this is a server side error we should follow these guidelines.

If there are validation errors when users submit a form, the entire page is reloaded.

And we show a inline error message at top of the form.

Image

@vishnoianil
Copy link
Member

@vishnoianil Should the text reflect the standard 404 not found or do we know the actual error, GH token invalid?

I think we do get error message, that we can catch in the code an rephrase.

@vishnoianil
Copy link
Member

@vishnoianil If this is a server side error we should follow these guidelines.

If there are validation errors when users submit a form, the entire page is reloaded.

And we show a inline error message at top of the form.

Image

That looks like a better option to me. @elkielki what do you think?

@Misjohns
Copy link
Collaborator

Misjohns commented Mar 4, 2025

Is there a fix a user can take to resolve this issue? If so, we should provide guidance in the error alert.

@vishnoianil
Copy link
Member

vishnoianil commented Mar 4, 2025

Is there a fix a user can take to resolve this issue? If so, we should provide guidance in the error alert.

For some scenarios, yes, like the token expired scenario. But if the github itself is down, user has no control over it.

@elkielki
Copy link
Collaborator

elkielki commented Mar 6, 2025

@vishnoianil If this is a server side error we should follow these guidelines.

If there are validation errors when users submit a form, the entire page is reloaded.

And we show a inline error message at top of the form.
Image

That looks like a better option to me. @elkielki what do you think?

Hi @vishnoianil, so I got the alert on the page, but the page currently flashes white before showing the alert. I'm not sure if this is due to the page refreshing or accessing GitHub and redirecting back to the login page after the error. Either way, I'm having trouble trying to get rid of it. Is it okay as-is or do you have any ideas as to what might help get rid of it?

InstructLab.UI.-.Google.Chrome.2025-03-05.16-32-22.mp4

@vishnoianil
Copy link
Member

Issue is fixed through #674

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants