Title: WP_REST_Application_Passwords_Controller::get_current_item
Published: March 9, 2021
Last modified: May 20, 2026

---

# WP_REST_Application_Passwords_Controller::get_current_item( WP_REST_Request $request ): 󠀁[WP_REST_Response](https://developer.wordpress.org/reference/classes/wp_rest_response/)󠁿|󠀁[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)󠁿

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_current_item/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_current_item/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_current_item/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_current_item/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_current_item/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_current_item/?output_format=md#wp--skip-link--target)

Retrieves the application password being currently used for authentication of a 
user.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_current_item/?output_format=md#parameters)󠁿

 `$request`[WP_REST_Request](https://developer.wordpress.org/reference/classes/wp_rest_request/)
required

Full details about the request.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_current_item/?output_format=md#return)󠁿

 [WP_REST_Response](https://developer.wordpress.org/reference/classes/wp_rest_response/)
|[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/) Response
object on success, or [WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
object on failure.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_current_item/?output_format=md#source)󠁿

    ```php
    public function get_current_item( $request ) {
    	$user = $this->get_user( $request );

    	if ( is_wp_error( $user ) ) {
    		return $user;
    	}

    	$uuid = rest_get_authenticated_app_password();

    	if ( ! $uuid ) {
    		return new WP_Error(
    			'rest_no_authenticated_app_password',
    			__( 'Cannot introspect application password.' ),
    			array( 'status' => 404 )
    		);
    	}

    	$password = WP_Application_Passwords::get_user_application_password( $user->ID, $uuid );

    	if ( ! $password ) {
    		return new WP_Error(
    			'rest_application_password_not_found',
    			__( 'Application password not found.' ),
    			array( 'status' => 500 )
    		);
    	}

    	return $this->prepare_item_for_response( $password, $request );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php#L510)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php#L510-L538)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_current_item/?output_format=md#related)󠁿

| Uses | Description | 
| [rest_get_authenticated_app_password()](https://developer.wordpress.org/reference/functions/rest_get_authenticated_app_password/)`wp-includes/rest-api.php` |

Gets the Application Password used for authenticating the request.

  | 
| [WP_REST_Application_Passwords_Controller::get_user()](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_user/)`wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php` |

Gets the requested user.

  | 
| [WP_REST_Application_Passwords_Controller::prepare_item_for_response()](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/prepare_item_for_response/)`wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php` |

Prepares the application password for the REST response.

  | 
| [WP_Application_Passwords::get_user_application_password()](https://developer.wordpress.org/reference/classes/wp_application_passwords/get_user_application_password/)`wp-includes/class-wp-application-passwords.php` |

Gets a user’s application password with the given UUID.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [is_wp_error()](https://developer.wordpress.org/reference/functions/is_wp_error/)`wp-includes/load.php` |

Checks whether the given variable is a WordPress Error.

  | 
| [WP_Error::__construct()](https://developer.wordpress.org/reference/classes/wp_error/__construct/)`wp-includes/class-wp-error.php` |

Initializes the error.

  |

[Show 3 more](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_current_item/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_current_item/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_application_passwords_controller/get_current_item/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_application_passwords_controller%2Fget_current_item%2F)
before being able to contribute a note or feedback.