Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parameter not allowed for this message type: code_challenge_method, how to fix it in nuxt?

in Nuxt I have the title error using auth v5. This is my current strategy:

enter image description here

The docs (https://dev.auth.nuxtjs.org/schemes/oauth2#codechallengemethod) says that you can use "plain" or "S256" as an option, I tried both but the error persists.

The only I cant manually get it work is by copy-pasting the oAuth in the url:

https://accounts.google.com/o/oauth2/auth/identifier?protocol=oauth2&response_type=token&client_id=MYCLIENTID&redirect_uri=https%3A%2F%2Flocalhost%3A3005%2Flogin&scope=profile%20email&state=sIpW-W_6h_QwUs0gCDV_o&flowName=GeneralOAuthFlow

Compare that link to the following:

https://accounts.google.com/o/oauth2/auth/identifier?protocol=oauth2&response_type=token&client_id=MYCLIENTID&redirect_uri=https%3A%2F%2Flocalhost%3A3005%2Flogin&scope=profile%20email&state=sIpW-W_6h_QwUs0gCDV_o&code_challenge_method=S256&code_challenge=fnyp2Ray850HEmHEwmoyQtIrPFPpHWBt4nVAz9p5Vxs&flowName=GeneralOAuthFlow

The only difference between the first and second link is that the first one actually works (I can login) and it doesn't have a challenge_method.

The second link doesn't work (it displays the google image above) but if you read the end of the link it has both the code_challenge_method & code_challenge

like image 551
Damian Perez Avatar asked Sep 26 '20 02:09

Damian Perez


1 Answers

After many hours of trial and error, the only way to make it work is by setting code_challenge_method to an empty string, like this:

enter image description here

The demo used in the nuxt auth module, does the same thing, they don't use any code_challenge_method with the google strategy

EDIT 10/06/2021

After doing further investigation, it seems that if I only use an empty code_challenge_method (just like the image above), google auth just doesn't seem to work anymore, my bet is that a broken commit was merged here, so in order to fix it I added a new property to my google strategy:

responseType: 'token id_token'

I also created a report for that bug here

like image 185
Damian Perez Avatar answered Sep 19 '22 23:09

Damian Perez