Open lifehome opened 4 years ago
Hey @lifehome, I'd be interested by this too, did you figured out ?
@lenybernard
I have managed to implement authorized graphql queries from both google oauth and email provider. You have to pass the token from the jwt callback so that it's accessible in the session callback, where you can then add it as a property to the sesssion object. You can then access the token using getSession();
To authorize the queries to strapi you pass the token in the authorization header of the request.
header: { Authorization: "Bearer ${token}" }
@NuggetOfOdium Would you be interested in creating a pull request with the changes that you suggested?
@ghoshnirmalya Sure thing, ill look into it on the weekend
Hi,
First of all, huge thanks to @ghoshnirmalya for the boilerplate, really appreciate it! It is however, I plan to use the default "Users" collection sits inside Strapi, with the "Email" provider.
Does anyone succeed with such a combination? I am currently trying to implement a "Credentials" provider from NextAuth, but sadly despite I stuff the user object with user id, email and even the JWT token returned from
/auth/local
at Strapi side, I am still confused how to use such method to call methods from Strapi, e.g. authenticated GraphQL queries.Here is my ugly code referencing the boilerplate, still debugging, so it might not work:
Regards, Ivan