How to create and manage an authentication token from the console
This page shows you how to create and manage an authentication token from the console.
You may need certain IAM permissions to carry out some actions described on this page. This means:
- you are the Owner of the Scaleway Organization in which the actions will be carried out, or
- you are an IAM user of the Organization, with a policy granting you the necessary permission sets
- You have an account and are logged into the Scaleway console
- You have created a functions namespace
- You have created a function
Creating authentication tokens from the console
-
Click Functions in the Serverless section of the side menu. The Serverless Functions page displays.
-
Click the relevant functions namespace to see a list of functions in this namespace.
-
Click the name of the relevant function in the Functions tab. The function’s details display.
-
Click the Security tab. The function’s security settings page displays.
-
Set the privacy policy to private.
-
Click Generate token. A pop-up displays.
-
Enter the token description and set an expiration date for the token. Optionally, tick the box No expiration date, to have a token with unlimited validity. Then click Generate token.
-
Copy the token from the pop-up and store it in a safe environment.
Important:The token key will only be available for copy once. Make sure to store it securely before leaving the page.
Using tokens
To use the token, you have to add the generated token to a X-Auth-Token
header.
To execute a private function by providing a token using curl
, run the following command:
curl -H "X-Auth-Token: <YOUR_GENERATED_TOKEN>" <YOUR_FUNCTION_ENDPOINT>
A private function observes this behavior:
- If a call is made without the
X-Auth-Token
header, the call is rejected (status code 403) - If a call is made with the
X-Auth-Token
header, the token is validated using a public key attached to the namespace.
Deleting tokens
Tokens will expire by default on their given expiry date. You can delete them manually if they are no longer needed.
-
Click Functions in the Serverless section of the side menu. The Serverless Functions page displays.
-
Click the relevant functions namespace to see a list of functions in this namespace.
-
Click the name of the relevant function in the Functions tab. The function’s details display.
-
Click the Security tab. A list of your functions settings displays.
-
Click «Delete Icon» in the Tokens panel. A pop-up displays.
-
Confirm by clicking Delete token to delete the token and to revoke access to the function.
Important:This action is irreversible and this token will not be able to access your function anymore.