Antipola: Mengeluarkan token refresh tanpa memanggil alur refresh
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Anda sedang melihat dokumentasi Apigee dan Apigee hybrid.
Lihat dokumentasi
Apigee Edge.
Token refresh digunakan untuk mendapatkan token akses baru setelah masa berlaku token akses
asli berakhir atau dicabut. Token refresh secara opsional diterbitkan bersama
token akses dengan beberapa jenis pemberian.
Antipola
Token refresh dapat diterbitkan oleh Apigee atau melalui resource eksternal.
Namun, ini adalah antipola jika token refresh tidak pernah digunakan melalui
operasi RefreshAccessToken.
Dampak
Mempertahankan token refresh secara tidak perlu berdampak negatif pada performa
dan keandalan sistem autentikasi.
Praktik terbaik
Jika token refresh tidak pernah diperlukan
Jika token refresh tidak diperlukan, developer harus menggunakan jenis pemberian 'kredensial
klien' atau 'implisit' saat membuat token akses baru.
Jenis pemberian ini tidak menerbitkan token refresh, yang diinginkan jika
fungsi token refresh tidak diperlukan.
Jika proxy hanya melakukan operasi baca dengan token refresh
Apigee menawarkan
GetOAuthV2Info yang dapat digunakan untuk mengambil atribut
token refresh. Developer tidak boleh menggunakan kebijakan ini untuk memvalidasi token refresh.
Token refresh tidak pernah digunakan untuk ditukar dengan
token akses baru. Perhatikan bahwa Apigee dapat berfungsi dengan
token akses dan refresh eksternal. Jika alur token refresh terjadi
di luar Apigee, sebaiknya gunakan operasi RefreshAccessToken
sehingga token refresh yang diimpor yang tidak lagi valid akan dihapus dengan benar
dari sistem Apigee.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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)"]]