Keys replace plaintext credentials in consumers and plugins, preventing credential leaks.
Prerequisites
A key is available. If not, Create a key.
Key references require official plugins version 2.1.10+ and custom plugins version 2.1.11+.
Reference a key in a consumer
-
Log on to the Cloud-native API Gateway console, select a region, and click Consumers in the left-side navigation pane.
-
Click Create Consumer. Enter a name, set Authentication Method to API Key, set Generation Method to Reference Key, and select a key under Attach Key.
NoteOnly API key authentication supports key references for consumer credentials.
Reference a key in a plugin
Use the $ref{secretName} syntax in plugin configurations, where secretName is the key name. Example Key-Auth configuration:
credentials:
# Reference the key named secretName
- $ref{secretName}
keys:
- apikey
- x-api-key
The secretName key grants access to the cloud-native gateway. Both official and custom plugins support key references.
View key reference details
In the Cloud-native API Gateway console, click Key in the left-side navigation pane. In the Referenced By column, click the reference count to view associated resources.