Antipattern: emissione di token di aggiornamento senza invocare il flusso di aggiornamento
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Stai visualizzando la documentazione di Apigee e Apigee hybrid.
Visualizza la documentazione di
Apigee Edge.
I token di aggiornamento vengono utilizzati per ottenere nuovi token di accesso dopo che il
token di accesso originale è scaduto o è stato revocato. I token di aggiornamento vengono emessi facoltativamente insieme ai token di accesso con alcuni tipi di concessione.
Antipattern
I token di aggiornamento possono essere emessi da Apigee o tramite risorse esterne.
Tuttavia, si tratta di un antipattern se il token di aggiornamento non viene mai utilizzato tramite l'operazione RefreshAccessToken.
Impatto
La persistenza dei token di aggiornamento influisce negativamente inutilmente sia sulle prestazioni che sull'affidabilità del sistema di autenticazione.
Best practice
Se il token di aggiornamento non è mai necessario
Se i token di aggiornamento non sono necessari, gli sviluppatori devono utilizzare i tipi di concessione "credenziali client" o "implicita" per generare nuovi token di accesso.
Questi tipi di concessione non emettono token di aggiornamento, il che è auspicabile se la funzionalità del token di aggiornamento non è richiesta.
Se il proxy esegue solo operazioni di lettura con token di aggiornamento
Apigee offre
GetOAuthV2Info che può essere utilizzato per recuperare gli attributi del token di aggiornamento. Gli sviluppatori non devono utilizzare questo criterio per convalidare i token di aggiornamento.
È un antipattern che il token di aggiornamento non venga mai utilizzato per scambiare un nuovo token di accesso. Tieni presente che Apigee può funzionare con
token di accesso e aggiornamento esterni. Se il flusso del token di aggiornamento avviene al di fuori di Apigee, ti consigliamo vivamente di utilizzare l'operazione RefreshAccessToken in modo che tutti i token di aggiornamento importati non più validi vengano rimossi correttamente dal sistema Apigee.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-05 UTC."],[],[],null,["# Antipattern: Issuing refresh tokens without invoking refresh flow\n\n*You're viewing **Apigee** and **Apigee hybrid** documentation.\nView [Apigee Edge](https://docs.apigee.com/api-platform/antipatterns/issuing-refresh-tokens) documentation.*\n\n\nRefresh tokens are used to obtain new access tokens after the original access\ntoken has expired or been revoked. Refresh tokens are optionally issued along\nwith access tokens with some of the grant types.\n\nAntipattern\n-----------\n\n\nRefresh tokens can be issued either by Apigee or via external resources.\nHowever, this is an antipattern if the refresh token is never used via the\nRefreshAccessToken operation.\n\nImpact\n------\n\n\nPersisting refresh tokens unnecessarily negatively impacts both performance\nand reliability of the authentication system.\n\nBest practice\n-------------\n\n### If the refresh token is never needed\n\n\nIf refresh tokens are not needed, developers should use the 'client\ncredentials' or 'implicit' grant types when generating new access tokens.\nThese grant types do not issue refresh tokens, which is desirable if the\nrefresh token functionality is not required.\n\n### If the proxy performs only read operation with refresh tokens\n\n\nApigee offers\n[GetOAuthV2Info](https://cloud.google.com/apigee/docs/api-platform/reference/policies/get-oauth-v2-info-policy#refresh-token) which can be used to retrieve refresh token\nattributes. Developers should not use this policy to validate refresh tokens.\nIt is an antipattern that the refresh token is never used to exchange for a\nnew access token. Note that Apigee can work with\n[external access and refresh tokens](/apigee/docs/api-platform/security/oauth/use-third-party-oauth-system). If the refresh token flow happens\noutside of Apigee, it's highly recommended to use the RefreshAccessToken\noperation such that any imported refresh tokens no longer valid are properly\nremoved from the Apigee system.\n\nFurther reading\n---------------\n\n[Refreshing an access token](/apigee/docs/api-platform/security/oauth/access-tokens#refreshinganaccesstoken)"]]