I'm trying to make a wordpress auth based on discord API. I'm actually verifying if the user was from a group on a discord server. I've done this part of the script in node.js and OAuth2 (part of the discord API). This part works fine.
But I got some problem with the wordpress auth. I've plan to use a unique account for all the user. Because I don't need a huge security, the website is juste a wiki about (knowledge website). I'm trying de log theme automatically by auth cookie. I want to reproduce the "wp_generate_auth_cookie" from the "wp-includes/pluggable.php" file but I'm in sstruggle with the hash part. I don't know how to reproduce the hash part.
I've see this post, but that don't really help me. I'm not a advanced user of node.js : Wordpress authentication in node.js
I don't know if it was the easiest way. If you have a another way, I'm open to your suggestion.
Thanks in advance for your help.
wp_generate_auth_cookie. First, that function is pluggable which means other implementations might tweak/replace it, something I've personally done, too. Second, do you have a token manager, too? You'll need that for this. Third, you'll have to replicatewp_hash,wp_saltandwp_generate_password, and possibly more. Instead, WordPress has a REST API that you should be able to use. Have your JS code talk to that and keep the WordPress stuff inside of WordPress.