Revert the following commits that tried to implement getToken using OAuthTokenManager

Revert "add use OAuthTokenManager and create instance in constructor"This reverts commit 2a1e7c9b0974ebd7e082d5a2fa62753d6254a767.Revert "Add missing ) to retrieveROPCToken"This reverts commit 8df5cfc49e.
Revert "Implement retrieveROPCToken as proposed in https://github.com/Part-DB/Part-DB-server/pull/1151#discussion_r2622976206"
This reverts commit 66cc732082.
This commit is contained in:
Marc Kreidler 2025-12-18 17:43:20 +01:00
parent 2a1e7c9b09
commit 60dc240d68
2 changed files with 43 additions and 26 deletions

View file

@ -159,21 +159,4 @@ final class OAuthTokenManager
return $this->saveToken($app_name, $access_token);
}
/**
* Retrieves an access token for the given app name using the client ROPC grant (so no user flow is needed)
* The app_name must be registered in the knpu_oauth2_client.yaml
* The token is saved to the database, and afterwards can be used as usual
* @param string $app_name
* @return OAuthToken
*/
public function retrieveROPCToken(string $app_name, string $user, string $password): OAuthToken
{
$client = $this->clientRegistry->getClient($app_name);
$access_token = $client->getOAuth2Provider()->getAccessToken('password', [
'username' => $user,
'password' => $password
]);
return $this->saveToken($app_name, $access_token);
}
}