microsoft / microsoft/kiota-php

Delegated Permission Cache Key

Open Beginner friendly
#55 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
8
Forks
10
Avg merge
10h 16m
Merged PRs (30d)
3

Description

The DelegatedPermissionTrait is missing the part of setting the cacheKey when the access token is null. According to the documentation, the cache key should be {tenantId}-{clientId} but is missing that part

Possible fix: Update the setCacheKey method with the proper fallback.

public function setCacheKey(?AccessToken $accessToken = null): void
{
	if ($accessToken && $accessToken->getToken()) {
		$uniqueIdentifier = hash("sha256", $accessToken->getToken());
		$this->cacheKey = "{$this->getTenantId()}-{$this->getClientId()}-{$uniqueIdentifier}";
	} else {
		// If access is not provided fallback to default {tenantId}-{clientId}.
		$this->cacheKey = "{$this->getTenantId()}-{$this->getClientId()}";
	}
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate DelegatedPermissionTrait and its setCacheKey method. Compare the null-access-token behavior with the documented {tenantId}-{clientId} format, then verify that the cache key uses that fallback while retaining the token-based format when a token is present.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authorization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.