Title: JSON API Auth
Author: Ali Qureshi
Published: <strong>کانوونی یەکەم 17, 2013</strong>
Last modified: حوزه‌یران 18, 2026

---

گەڕان لە پێوەکراوەکان

![](https://ps.w.org/json-api-auth/assets/banner-772x250.png?rev=1965712)

![](https://ps.w.org/json-api-auth/assets/icon-256x256.png?rev=1965697)

# JSON API Auth

 لەلایەن [Ali Qureshi](https://profiles.wordpress.org/parorrey/)

[داگرتن](https://downloads.wordpress.org/plugin/json-api-auth.3.1.0.zip)

 * [وردەکارییەکان](https://ku.wordpress.org/plugins/json-api-auth/#description)
 * [پێداچوونەوەکان](https://ku.wordpress.org/plugins/json-api-auth/#reviews)
 *  [دامەزراندن](https://ku.wordpress.org/plugins/json-api-auth/#installation)
 * [گەشەپێدان](https://ku.wordpress.org/plugins/json-api-auth/#developers)

 [پشتیوانی](https://wordpress.org/support/plugin/json-api-auth/)

## وەسف

JSON API Auth extends the JSON API Plugin to allow RESTful user authentication.

JSON API Plugin, that is required, was closed on August 7, 2019 from WordPress repository.
You can download [JSON API Plugin](https://github.com/PI-Media/json-api) from https://
github.com/PI-Media/json-api until it is republished and available on WordPress.

Features include:

 * Generate Auth Cookie for user authentication
 * Validate Auth Cookie
 * Get Current User Info

For documentation: See ‘Other Notes’ tab above for usage examples.

Credits: http://www.parorrey.com/solutions/json-api-auth/

## سکرین شۆتەکان

[⌊Call to generate_auth_cookie endpoint using Postman⌉⌊Call to generate_auth_cookie
endpoint using Postman⌉[

Call to generate_auth_cookie endpoint using Postman

[⌊Call to get_currentuserinfo endpoint using Postman⌉⌊Call to get_currentuserinfo
endpoint using Postman⌉[

Call to get_currentuserinfo endpoint using Postman

[⌊Call to validate_auth_cookie endpoint using Postman⌉⌊Call to validate_auth_cookie
endpoint using Postman⌉[

Call to validate_auth_cookie endpoint using Postman

## دامەزراندن

First you have to install the JSON API for WordPress Plugin (https://wordpress.org/
extend/plugins/json-api/installation/). or You can download [JSON API Plugin](https://github.com/PI-Media/json-api)
from https://github.com/PI-Media/json-api

To install JSON API Auth just follow these steps:

 * upload the folder “json-api-auth” to your WordPress plugin folder (/wp-content/
   plugins)
 * activate the plugin through the ‘Plugins’ menu in WordPress or by using the link
   provided by the plugin installer
 * activate the controller through the JSON API menu found in the WordPress admin
   center (Settings -> JSON API)

## پهد

Thanks to ‘mattberg’ who wrote the auth controller (https://github.com/mattberg/
wp-json-api-auth) initially. I have added few methods and authored it as a WordPress
plugin so that it could easily be searched and installed vis WordPress.

 * There are following methods available: validate_auth_cookie, generate_auth_cookie,
   clear_auth_cookie, get_currentuserinfo
 * nonce can be created by calling http://localhost/api/get_nonce/?controller=auth&
   method=generate_auth_cookie
 * You can then use ‘nonce’ value to generate cookie. http://localhost/api/auth/
   generate_auth_cookie/?nonce=f4320f4a67&username=Catherine&password=password-here
 * Use cookie like this with your other controller calls: http://localhost/api/contoller-
   name/method-name/?cookie=Catherine|1392018917|3ad7b9f1c5c2cccb569c8a82119ca4fd

For instance, you have a new controller ‘events’ and want to allow users to post
new ‘event’ using ‘add_event’ method.
 This is how you will call the end point with
cookie and post the event with user info:

http://localhost/api/events/add_event/?cookie=Catherine|1392018917|3ad7b9f1c5c2cccb569c8a82119ca4fd

If you want sample code how it can be done, check ‘JSON API User’ plugin https://
wordpress.org/plugins/json-api-user/. This Auth plugin is part of JSON API User 
plugin.

### Method: validate_auth_cookie

It needs ‘cookie’ var.

http://localhost/api/auth/validate_auth_cookie/?cookie=Catherine|1392018917|3ad7b9f1c5c2cccb569c8a82119ca4fd

### Method: generate_auth_cookie

It needs `username`, `password` vars. `seconds` is optional.

Then generate cookie: http://localhost/api/auth/generate_auth_cookie/?username=john&
password=PASSWORD-HERE

Optional ‘seconds’ var. It provided, generated cookie will be valid for that many
seconds, otherwise default is for 14 days.

generate cookie for 1 minute: http://localhost/api/auth/generate_auth_cookie/?username
=john&password=PASSWORD-HERE&seconds=60

60 means 1 minute.

### Method: get_currentuserinfo

It needs ‘cookie’ var.

http://localhost/api/auth/get_currentuserinfo/?cookie=Catherine|1392018917|3ad7b9f1c5c2cccb569c8a82119ca4fd

## پێداچوونەوەکان

![](https://secure.gravatar.com/avatar/1e0616296c4d26d92cb64457f967d9ac34aae2b2b1980e1fcf56af41183c5739?
s=60&d=retro&r=g)

### 󠀁[Work well.](https://wordpress.org/support/topic/work-well-33/)󠁿

 [Sarankumar](https://profiles.wordpress.org/sarankumar/) ئایار 27, 2017

Working perfectly

![](https://secure.gravatar.com/avatar/9c7be41168a828b3275c2a320c1b629708f7a7af499541029a40e662b9320a3e?
s=60&d=retro&r=g)

### 󠀁[Great piece of Cake](https://wordpress.org/support/topic/great-piece-of-cake/)󠁿

 [metaeditor](https://profiles.wordpress.org/metaeditor/) کانوونی یەکەم 13, 2016

Great piece of Cake, but incompatible to the Jsone APi Plugin Authentication only
for “new” own Controller

![](https://secure.gravatar.com/avatar/47299eccdedeedd18270c54e217d1a9a8dfc3f99a448f3f9e358691957ca2ce1?
s=60&d=retro&r=g)

### 󠀁[user feedback](https://wordpress.org/support/topic/user-feedback-1/)󠁿

 [mainsufian](https://profiles.wordpress.org/mainsufian/) ئەیلوول 3, 2016 1 reply

Hi, I am using the awesome JSON API plugin. it was a nice experience. really thankyou

![](https://secure.gravatar.com/avatar/0e5cbdf525c886c49ff1bdb7f689cb83dad2882ef483f42ebb50198662ecf77f?
s=60&d=retro&r=g)

### 󠀁[Access to CPT post data](https://wordpress.org/support/topic/access-to-cpt-post-data/)󠁿

 [thinkerman](https://profiles.wordpress.org/thinkerman/) ئەیلوول 3, 2016 6 replies

Hi, I am using the awesome JSON API plugin. I read I can’t have access to the posts
postmeta unless I’m authenticated and I thought maybe your plugin is the solution
to that. I have installed your plugin but not entirely sure how to use it in my 
application.

 [ خوێندنەوەی 11 پێداچوونەوە ](https://wordpress.org/support/plugin/json-api-auth/reviews/)

## بەشداربووان و گەشەپێدەران

“JSON API Auth” نەرمەواڵەیەکی سەرچاوە کراوەیە. ئەم کەسانەی خوارەوە بەشدارییان تێدا
کردووە.

بەشداربووان

 *   [ Ali Qureshi ](https://profiles.wordpress.org/parorrey/)

[“JSON API Auth” وەربگێڕە بۆ زمانەکەی خۆت.](https://translate.wordpress.org/projects/wp-plugins/json-api-auth)

### دەتەوێت بەشداربیت لە گەشەپێدان؟

[گەڕان لە کۆدەکەدا بکە](https://plugins.trac.wordpress.org/browser/json-api-auth/)،
سەیری [تەمارگەی (SVN)](https://plugins.svn.wordpress.org/json-api-auth/) بکە، یان
بەشداربە لە [ڕووداوتۆماری گەشەپێدان](https://plugins.trac.wordpress.org/log/json-api-auth/)
لە ڕێگەی [(RSS)](https://plugins.trac.wordpress.org/log/json-api-auth/?limit=100&mode=stop_on_copy&format=rss).

## ڕووداوتۆمارگەریی گۆڕین

#### 3.1.0

 * Tested and confirmed working with WordPress 7.0
 * Bumped minimum PHP requirement to 7.4
 * Replaced deprecated `wp_capabilities` user meta key with `$user->roles` for reliable
   role retrieval
 * Switched avatar retrieval to `get_avatar_url()` (WP 4.2+) with regex fallback,
   fixing broken avatar URLs in modern WordPress
 * Added `sanitize_text_field()` to POST parameter handling for improved input security
 * Fixed `isset()` check on `json_api->query->cookie` in cookie auth hook to avoid
   PHP notices

#### 3.0.0

 * Updated for WordPress version 6.8

#### 2.9.1

 * Fixed a bug for generate_auth_cookie, get_currentuserinfo endpoints for avatar
 * Updated for WordPress version 6.4.1

#### 2.9.0

 * Updated for WordPress version 6.1.1

#### 2.8.0

 * Updated for WordPress version 6.0.1

#### 2.7.1

 * Updated for WordPress version 5.9

#### 2.7.0

 * Updated for wordpress version 5.8

#### 2.6.0

 * Updated for wordpress version 5.7

#### 2.5.0

 * Updated for wordpress version 5.5.3

#### 2.4.0

 * Fixed bug in the generate_auth_cookie endpoint.

#### 2.3.0

 * Updated for JSON API Plugin diretory check error and updated action links.

#### 2.2.0

 * Updated for GitHub and settings action links.

#### 2.1.0

 * Updated for WordPress version & added JSON API plugin GitHub link due its closing
   down on WordPress repository.

#### 2.0.0

 * Updated for wordpress version

## مێتا

 *  وەشان **3.1.0**
 *  دوایین بەڕۆژکردنەوە **1 حەفتە لەمەوبەر**
 *  دامەزراندنی چالاک **700+**
 *  وەشانی وۆردپرێس ** 3.0.1 یان بەرزتر **
 *  تاقیکراوەتەوە تا **7.0**
 *  وەشانی PHP ** 7.4 یان بەرزتر **
 *  زمان
 * [English (US)](https://wordpress.org/plugins/json-api-auth/)
 * تاگەکان
 * [api](https://ku.wordpress.org/plugins/tags/api/)[json api](https://ku.wordpress.org/plugins/tags/json-api/)
 *  [بینینی پێشکەوتوو](https://ku.wordpress.org/plugins/json-api-auth/advanced/)

## هەڵسەنگاندنەکان

 4.7 out of 5 stars.

 *  [  9 5-star reviews     ](https://wordpress.org/support/plugin/json-api-auth/reviews/?filter=5)
 *  [  1 4-star review     ](https://wordpress.org/support/plugin/json-api-auth/reviews/?filter=4)
 *  [  1 3-star review     ](https://wordpress.org/support/plugin/json-api-auth/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/json-api-auth/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/json-api-auth/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/json-api-auth/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/json-api-auth/reviews/)

## بەشداربووان

 *   [ Ali Qureshi ](https://profiles.wordpress.org/parorrey/)

## پشتیوانی

هیچت هەیە بۆ وتن؟ پێویستت بە یارمەتییە؟

 [بینینی مەکۆی پاڵپشتی](https://wordpress.org/support/plugin/json-api-auth/)

## ببەخشە

دەتەوێت پشتگیریی بەرەوپێشچوونی ئەم پێوەکراوە بکەیت؟

 [ ببەخشە بەم پێوەکراوە ](http://www.parorrey.com)