Skip to content

Commit 9889389

Browse files
committed
Require a user when creating a token
1 parent b9d7374 commit 9889389

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

inc/tokens/class-access-token.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ public static function get_by_id( $id ) {
6767
}
6868

6969
public static function create( Client $client, WP_User $user ) {
70+
if ( ! $user->exists() ) {
71+
return new WP_Error(
72+
'oauth2.tokens.access_token.create.no_user',
73+
__( 'Invalid user to create token for.', 'oauth2' )
74+
);
75+
}
76+
7077
$data = array(
7178
'user' => $user->ID,
7279
);

0 commit comments

Comments
 (0)