auth0
;auth0-api-role
.auth0-api-role
that lets you execute your API Gateway methods. For more information on this process, please see User Access Permissions for Amazon API Gateway.
arn:aws:execute-api:us-east-2:484857107747:97i1dwv0j4/*/POST/
You’ll strip the method name to get the base ARN for the API:
arn:aws:execute-api:us-east-2:484857107747:97i1dwv0j4/*
The wildcard (*
) in the ARN above enables permissions to your API for all stages, but you can deploy different stages individually (for example, development, then test, then production).
Select the auth0-api-role
role you just created to open its Summary page.
Expand Inline Policies, and click click here.
Select Custom Policy and click Select.
Edit your policy document. You can set the Policy Name to whatever you would like, but we suggest something like api-gateway-policy
. To enable access to the API methods for this role, apply the following policy after updating the ARN with the one for your API.
/pets
.
Click the Method Request link.
Click the edit icon beside the Authorization Type, and select AWS_IAM. Now click the Check Button beside the field to save the setting.
OPTIONS
request to see what actions the site will permit.
Select /pets
under Resources, and click Create Method. In the drop-down, select OPTIONS, and click the checkmark to save the setting.
The Options method is used by the browser to get the necessary HTTP headers, but the function needs further instructions on what to do. Under the OPTIONS
Setup screen, set the following variables/parameters:
OPTIONS
Method Execution page. Open the Method Response page.
Expand the 200 section located under the HTTP Status bar and add the following response headers:
'Content-Type,X-Amz-Date,Authorization,x-api-key,x-amz-security-token'
;'*'
'POST, GET, OPTIONS'
'*'
.
Test
. Click the Deploy button.
On the result page, navigate to SDK Generation. Select JavaScript as the Platform. Click the Generate SDK button.
Save the downloaded zip file for later use.