Skip to content

getAccessTokenData() Returns NULL Despite Valid Token Data #1079

@reyd773

Description

@reyd773

Title:

getAccessTokenData() Returns NULL Despite Valid Token Data

Description:

I'm experiencing an issue with the getAccessTokenData() function where it returns NULL even when there are valid values in the $token variable.

Steps to Reproduce:

  1. Call the getAccessTokenData() method with a valid request and response.
  2. Ensure that the token parameter is correctly retrieved and the token exists in the storage.
  3. Observe that the function returns NULL instead of the expected token data.

Expected Behavior:

The function should return the access token data as an array when provided with a valid token.

Actual Behavior:

The function returns NULL, which prevents further processing.

Code Snippet:

Here’s the relevant part of the code for reference: bshaffer\oauth2-server-php\src\OAuth2\Controller\ResourceController.php

public function getAccessTokenData(RequestInterface $request, ResponseInterface $response)
{
    // Existing logic...
    if ($token_param = $this->tokenType->getAccessTokenParameter($request, $response)) {
        // Check token validity...
        return $token; // This should return the token if valid
    }
    // Additional logic...
    return null;
}

Suggested Fix:

In the updated version of the function, ensure that the return statement at the end is modified to return $token ?? null; to correctly handle the case when the token is valid.

Please let me know if you need any additional information or further assistance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions