Skip to content

Same data returned from diffrent access tokens #98

@Asis2019

Description

@Asis2019

I have a scenario where I needed to loop through all the stored tokens and retrieve some user data with them. The current cache implementation doesn't take the access token into account meaning that if you're calling the same endpoint (identity in my case) but with different access tokens, you will get the same data every time.

Current code:

// Construct request:
$api_request = $this->api_endpoint . $suffix;
		
// This identifies a unique request
$api_request_hash = md5($api_request);

Suggessted fix:

// Construct request:
$api_request = $this->api_endpoint . $suffix;
		
// This identifies a unique request
$api_request_hash = md5($api_request . $this->access_token);

If anyone is running into this issue you can empty the cache before making your request as a quick fix.

$client = new API($token); //Create client
API::$request_cache = null; //Empty the cache
$response = $client->get_data("identity"); //Make the request

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions