Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter kamov

    (@lucifero)

    I was to create, but after user creation, is returned cookie,

    {“status”:”ok”,”cookie”:”xxx|1484847138|xxxxxxxRe|d8a2609e97aa38ee7004c5ac6f6d1504dbc5f507dcc8fa4433e1eaecc4468c11″,”user_id”:6}

    so I should create a cookie for authenticate user?

    which is name and which the value?

    thanks

    Thread Starter kamov

    (@lucifero)

    I found /api/user/generate_auth_cookie

    But I notice that the password that I use for register don’t work even when try to login via WP.

    What I missing here?

    Thanks

    Thread Starter kamov

    (@lucifero)

    I use password for register and not user_pass…

    Now I was able to register and authenticate, and I receive this cookie:

    [cookie] => xxx|1484854666|14auLa3MRK92O9PBHDekdc64NcPXs4KoO83cQfBBA6U|ac548aad1430039a80d09ce9bb902c6a0de5e3552b0730e7c26c971fc97db581
    [cookie_name] => wordpress_logged_in_f3305040aa19de6d951fc7bc04a0fd49

    I set this cookie using setcookie() but then user is not logged-in, how to logged-in user in WP ?

    thanks

    Thread Starter kamov

    (@lucifero)

    It seem not possible to authenticate, right?
    I would like to implement single sign-on with my application
    thanks!

    Plugin Author Ali Qureshi

    (@parorrey)

    You can authenticate. You need valid cookie to update user meta or whatever endpoint reacquires cookie.

    you can setup your own password while registering by sending user_pass.

    If you want to implement single signon, you should check fb_connect endpoint, that should help.

    Thread Starter kamov

    (@lucifero)

    Thanks for your reply.

    This mean that single signon is not implemented right? I will check into. But I can’t find anywhere docs how to implement custom endpoint.

    Can you please tell me the difference between your JSON API plugin and WP API added recently in the core?

    I see that you have JSON API Auth, but seem that have the same API of JSON API User, it’s deprecated JSON Api Auth?

    Thanks!

    Thread Starter kamov

    (@lucifero)

    Please tell me if correct.

    1) Copy/Paste function fb_connect() and rename to single_signon

    2) Update code for my need

    3) Then?

    Plugin Author Ali Qureshi

    (@parorrey)

    JSON API Auth’s all endpoints are now part of JSON API User. If someone wants to use Auth plugin, it is still good enough.

    I can’t really comment what’s the new, I have not used or seen the REST API 2.0.

    For the SSO, the User Plus version has Google connect in addition to fb_connect but that’s about it.

    You can use fb_connect endpoint code and example to create your own SSO.

    Regarding custom endpoint creation, just open /controller/User.php controller and start editing.

    Plugin Author Ali Qureshi

    (@parorrey)

    Please tell me if correct.

    1) Copy/Paste function fb_connect() and rename to single_signon

    2) Update code for my need

    3) Then?

    then your endpoint will appear /api/user/your_custom/

    • This reply was modified 7 years, 10 months ago by Ali Qureshi.
    Thread Starter kamov

    (@lucifero)

    It seem that authentication is like after registration and after generate cookie:

    $expiration = time() + apply_filters(‘auth_cookie_expiration’, $seconds, $user_id, true);

    $cookie = wp_generate_auth_cookie($user_id, $expiration, ‘logged_in’);

    but then why user is not logged-in also in WP after ?

    I need that after someone register/login on my application, I send to api username/pass for authenticate also on WP:

    Thanks

    Thread Starter kamov

    (@lucifero)

    I have implement this:

    https://pastebin.com/8YfZQwut

    but user is not authenticated after this…

    Any idea how to do this?

    Thanks

    Thread Starter kamov

    (@lucifero)

    >then your endpoint will appear /api/user/your_custom/

    Yes, work fine this part!

    I just guess how to authenticate user now, I am trying also like:

    do_action( ‘wp_login’, $user->user_login, $user );
    or
    wp_authenticate_username_password($user, $user_name, $password);

    Thread Starter kamov

    (@lucifero)

    I have this case:

    1) someone login on my application under https://www.myapplication.com
    2) I call API endpoint by passing email and password
    3) Then on WP I authenticate this user
    4) When my user visit https://www.mywordpress.com, then should be authenticate also there.

    Plugin Author Ali Qureshi

    (@parorrey)

    you just should use generate_auth_cookie and then use cookie value like this to authenticate it:

    $user_id = wp_validate_auth_cookie($cookie, 'logged_in');

    Thread Starter kamov

    (@lucifero)

    I understand, what you suggest, I have try already yesterday.

    this is my steps using your existing API:

    1) curl https://mywordpress.com/api/user/generate_auth_cookie/?username=$username&password=$password

    Then I save response inside $response, and I retrieve $cookie, and then call:

    2) curl https://mywordpress.com/api/user/validate_auth_cookie/?cookie=$cookie

    It return status OK, but if I visit mywordpress.com, I am not logged-in.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Can’t create user’ is closed to new replies.