How to login 2 websites at the same time? | how to login with wp REST API out of Wordpress site?

Viewed 56

I built 2 websites. One is Codeigniter(localhost/test) and other one is Wordpress(localhost/sample). If I login in the first site (e.g: localhost/test), there is no need to login in the second site again. So I want to login 2 websites at the same time within one login action. I tried as following. That is my code.

<!DOCTYPE html>
<html lang="en">    
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <head>
        <!-- Title -->
        <title>Test</title>
        <!-- Required Meta Tags Always Come First -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    </head>

    <body>
        <form action="http://localhost/sample/wp-json/wp/v2/users" method="post">  //--> target site URL
            <div class="form-group">
                <label for="email">Username:</label>
                <input type="text" class="form-control" name="username" placeholder="Enter username" id="username">
            </div>
            <div class="form-group">
                <label for="email">Email address:</label>
                <input type="email" class="form-control" name="email" placeholder="Enter email" id="email">
            </div>
            <div class="form-group">
                <label for="pwd">Password:</label>
                <input type="password" class="form-control" name="password" placeholder="Enter password" id="password">
            </div>
            <button type="submit" class="btn btn-primary">Submit</button>    
        </form>        
    </body>
</html>

If I click the submit, entered parameter transferred to the target site URL, and I got the following error.

Error Screenshot enter image description here

Target site URL("http://localhost/sample/wp-json/wp/v2/users") is Wordpress REST API. Is it possible to proceed this ?

0 Answers
Related