Search code examples
next.jsstrapinext-auth

STRAPI: how to register a new user when logged with google


Hi i'm currently working on a login | resgiter page,

My frontend is with Nextjs (app directory) and my back end is with STRAPI (REST api)

I'm trying to use Nextauth with google provider to create or loggin user in my app

i can handle the user with google in my front end there is no probleme here

my problem is with my backend, how i can i register a new user in STRAPI using google OAUTH ?

because if my google user is not register in my STRAPI backend he won't be able to make change because he won't have the correct JWT

does anyone had already the same issue or can help me to find a way to fix it ?


Solution

  • You need to activate the provider in the strapi admin panel and entyer your google id and secret

    Take a look at this blog - https://strapi.io/blog/user-authentication-in-next-js-with-strapi

    note that this is slightly outdated and you should add /api/ to the fetch url