I am trying to make A NodeJs CLI by which I can login in hosted WordPress account using NodeJs so I used Passport-WordPress.
I wrote a code but I don't know what to do next and how to check if I am login to the WordPress or not.
this my wordpress hosted Website
Here is my code
Index.js
const inquirer = require("inquirer");
const passport = require("passport");
const WordpressStrategy = require("passport-wordpress").Strategy;
function wordpress() {
inquirer
.prompt([
{
name: "wpWebsite",
message: " Enter Your Website or Blog:",
},
{
name: "wpUserName",
message: " Enter UserName or Email: ",
},
{
type: "password",
name: "wpPassword",
message: " Enter Password: ",
},
])
.then((answers, cb) => {
passport.use(
new WordpressStrategy(
{
clientID: answers.wpUserName,
clientSecret: answers.wpPassword,
callbackURL: `https://example.com/auth/wordpress/callback`,
},
function (accessToken, refreshToken, profile, done) {
console.log(done);
}
)
);
});
}
anyone have any idea am I doing correct or not ?
I have Few question here such as
- What is accessToken here?
- What is refreshToken here?
- What is profile? Is the profile is same as email id or username?
- what is callbackUrl? Do I have to put my website URL ?
from Connect / Login WordPress Hosted Website or Blog with NodeJs
No comments:
Post a Comment