I've have a hard time trying to find a tutorial on how to properly do Social Authentication w/ Strapi and NextJS. I'm able to properly setup Strapi and receive the JSON object containing the JWT and user, but don't know how to properly handle the callback or how to store the JWT in a cookie.
I'm looking to avoid using auth0, passport and just utilise Strapi, React and NextJS to their full potential.
Utilizing Strapi's Example I've created a list of buttons that redirect the user to their providers
const SocialButton = ({ provider }: any) => {
return (
<a href={`https://api.website.com/connect/${provider}`} className={s.link}>
<button className={s[provider]} type='button'>
{provider}
</button>
</a>
);
From there, the request is sent to the server, the token retrieved, the response sent back to the Strapi server, and directed (by Strapi callback) to my site.
This is where I'm stuck.. I'm not sure what to do.. to use something like https://github.com/zeit/swr, UseEffect, GetServerSide.. ext on the API endpoint to capture the response and store it in a cookie?
If someone could help me understand the process in detail. I'd greatly appreciate it.