I’m trying to set up the Google provider in my Strapi v4 backend. The provider settings are successfully updated, however, when I’m trying to make a Postman request to http://localhost:1337/api/auth/google/callback?access_token=mytoken it gives the following error:
Would that not be without /api
Because it seems your trying to access an api to authenticate, but how do you authenticate if that route needs authentication? Just a thought
If you do figure it out, can you please post the solution ?
I am stuck on this integration for last two days. Trying nextjs + nextauth + strapi with google auth.
Strapi returns 401… Unauthorized… Did some research… looks like it is unable to parse the token sent back. Is the procedure correct? Is the ‘id_token’ query_param sent by Strapi’s get request to frontend end url be processed by the client in any way?
If someone has working example of using next-auth with strapi and google provider it will help a a lot.
Strapi V4 with google providers is not working for sure. Tried the strapi-examples with react-login without change and it is broken too.
Did some more digging and logging. For some resaon the token sent to frontend app is not parsable by Strapi if the token is sent back as auth_token… Getting the errors below. Token is being thrown our with “Invalid algorithm” error… The logs below were added for debugging by me in node_modules folder for testing.
KGM inside verify of jsonwebtoken :: decodedToken exists!
KGM verify of jsonwebtoken : decodedToken.header.alg is == RS256
[2021-12-25 00:57:27.027] info: IndexOf
[2021-12-25 00:57:27.027] info: 0
[2021-12-25 00:57:27.027] info: about to reject - Invalid token err
[2021-12-25 00:57:27.027] info: {“name”:“JsonWebTokenError”,“message”:“invalid algorithm”}
Guess this need inputs from Strapi V4 team. If there is a tested V4 with Google Auth example that would help. The example in repository (Login-React) is also broken.