generate_auth_cookie
This endpoint is used to generate auth cookie for the user. This cookie is used for user authentication throughout the user related endpoints.
Generated cookie is valid for 14 days. Optional ‘seconds’ var can be used to limit this. If provided, generated cookie will be valid for that many seconds, otherwise default is for 14 days.
Example for valid cookie for 1 minute:
http://localhost/api/userplus/generate_auth_cookie/?username=john&password=PASSWORD-HERE&seconds=60
Resource URL
http://localhost/api/userplus/generate_auth_cookie/
Method
POST
Required Parameters
- username
- password
- key – get API key from Settings > User Plus
Optional Parameters
- seconds - 60 means 1 minute - default is for 14 days
- web_login - if true, will login user to website
Sample Request URL
http://localhost/api/userplus/generate_auth_cookie/?username=john&password=PASSWORD-HERE
Sample Response
{
"status": "ok",
"cookie": "username|1578043043|V9kG5TTJBIKZiPNJjlvXJlMnSmwciXqJD|cb946f4dba7646e58a7c3c8f42166457a2e6a1f9c94144e33379c951fc7d4add",
"cookie_admin": "username|1578043043|rPuOSi1Tn74cYBfyWRiY36Lea9RpC|f9130ee1bcf12d7fa6554516b42ae043af474bd2d16461279d560a5da8e2a82d",
"cookie_name": "wordpress_logged_in_cbd2cc1956862d4e44d4867e50b5a44d",
"user": {
"id": 1,
"username": "username",
"nicename": "Nice Name",
"email": "email",
"url": "",
"registered": "2014-11-26 07:13:23",
"displayname": "Display Name",
"firstname": "Nice",
"lastname": "Name",
"nickname": "Nick",
"description": "",
"capabilities": "",
"avatar": null
}
}