nuxt / nuxters

https://nuxters.nuxt.com
MIT License
133 stars 17 forks source link

422 error on login with github #22

Closed maximepvrt closed 11 months ago

damisparks commented 11 months ago

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

maximepvrt commented 11 months ago

https://github.com/nuxt/nuxters/assets/1840026/3c96c620-0b74-45a2-a93d-e40f29dd0f82

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:

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,

Atinux commented 11 months ago

The errors comes from https://github.com/nuxt/nuxters/blob/373768a7995dfcc3cc4b970ad539e4c75d8e9ec1/server/routes/oauth/github.ts#L10-L16 it seems that it cannot keep the cookie between the two apps 🤔

maximepvrt commented 11 months ago

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 commented 11 months ago

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
Atinux commented 11 months ago

Nice idea @maximepvrt

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

maximepvrt commented 11 months ago

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 commented 11 months ago

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