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

422 error on login with github #22

Closed
maximepvrt opened this issue Jul 21, 2023 · 8 comments
Closed

422 error on login with github #22

maximepvrt opened this issue Jul 21, 2023 · 8 comments

Comments

@maximepvrt
Copy link
Contributor

No description provided.

@damisparks
Copy link

@maximepvrt, could you provide more information on this issue?
Ideally, screenshots, console logs and a way to reproduce the error.

@maximepvrt
Copy link
Contributor Author

screen-20230722-220729.2.mp4

hello,

I encountered an issue while trying to connect to github using oauth through the brave mobile browser. whenever I attempt to log in, the browser redirects me to chrome for the authentication process. however, even after successful authentication, i receive a 422 error.

Steps to reproduce:

  • Open Brave mobile browser on my Google Pixel 5 running Android 13.
    Navigate to the GitHub login page and click on the "Sign in with GitHub" button.
  • Brave redirects to Chrome for authentication.
  • Complete the authentication process on Chrome.
  • After successful authentication, I encounter a 422 error.

Expected Behavior:
I expect to be able to log in to GitHub using OAuth directly through the Brave mobile browser without any errors or redirections to other browsers.

Additional Information:
Interestingly, even when I use the Chrome browser on my device, I still face an inconvenience. When I click on the "Sign in with GitHub" button, I am prompted to select the Chrome browser again for the authentication process, which seems redundant.

Best,

Copy link
Member

atinux commented Aug 2, 2023

The errors comes from

if (state !== getCookie(event, 'state')) {
throw createError({
statusCode: 422,
statusMessage: 'Potential cross-site request forgery detected.',
})
}
it seems that it cannot keep the cookie between the two apps 🤔

@maximepvrt
Copy link
Contributor Author

Thank you for your response @atinux and for identifying the source of the issue.

Regarding the behavior of the mobile browser, I have noticed that when I click on the "Sign in with GitHub" button from both the Chrome and Brave browsers on my mobile device, I am prompted to choose an application for the authentication process.

Could you kindly shed some light on why this app selection prompt is appearing? Is there a specific reason for this behavior, and is there a way to configure it so that the authentication process can be streamlined without the need for manual app selection?

@maximepvrt
Copy link
Contributor Author

https://github.com/nuxt/nuxters/blob/main/components/home/HomeCard.vue#L92

Why not use the "to" attribute of the UButton ? currently it generate a <a> inside a <button>

Capture d’écran 2023-08-02 à 18 02 14

Copy link
Member

atinux commented Aug 3, 2023

Nice idea @maximepvrt

Pushed a commit to update it, could you try again?

@maximepvrt
Copy link
Contributor Author

Thank you @atinux. I tested, but …

In regard to the mobile browser behavior, I've come to realize that the prompt to select an application for the authentication process occurs due to the Android GitHub application intercepting all GitHub URLs. Subsequently, it suggests redirecting the externally generated GitHub link to a browser (without brave, my browser 😅)

@maximepvrt
Copy link
Contributor Author

maximepvrt commented Aug 3, 2023

Github Android App issue https://github.com/orgs/community/discussions/51846

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

No branches or pull requests

3 participants