Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rinav/aa4f055686bedeab55f64f90d1f85bbf to your computer and use it in GitHub Desktop.

Select an option

Save rinav/aa4f055686bedeab55f64f90d1f85bbf to your computer and use it in GitHub Desktop.
Login with Amazon (OAuth)
{
"info": {
"name": "Login with Amazon (OAuth)",
"_postman_id": "c1a33327-55de-7a7c-0103-44829c86b65a",
"description": "A small collection of sample requests in the OAuth flow for LWA authentication.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "1 LWA Get Authorization Code",
"request": {
"auth": {
"type": "noauth"
},
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/x-www-form-urlencoded"
}
],
"body": {},
"url": {
"raw": "https://www.amazon.com/ap/oa?client_id={{CLIENT_ID}}&response_type=code&redirect_uri={{REDIRECT_URI}}&scope={{SCOPE}}&state=SPECIAL",
"protocol": "https",
"host": [
"www",
"amazon",
"com"
],
"path": [
"ap",
"oa"
],
"query": [
{
"key": "client_id",
"value": "{{CLIENT_ID}}",
"equals": true
},
{
"key": "response_type",
"value": "code",
"equals": true
},
{
"key": "redirect_uri",
"value": "{{REDIRECT_URI}}",
"equals": true
},
{
"key": "scope",
"value": "{{SCOPE}}",
"equals": true,
"description": "profile:user_id profile postal_code"
},
{
"key": "state",
"value": "SPECIAL",
"equals": true
}
]
},
"description": ""
},
"response": []
},
{
"name": "2 LWA Get Access Token with Authorization Code",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/x-www-form-urlencoded"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "grant_type",
"value": "authorization_code",
"description": "",
"type": "text"
},
{
"key": "code",
"value": "{{CODE}}",
"description": "",
"type": "text"
},
{
"key": "client_id",
"value": "{{CLIENT_ID}}",
"description": "",
"type": "text"
},
{
"key": "client_secret",
"value": "{{CLIENT_SECRET}}",
"description": "",
"type": "text"
},
{
"key": "redirect_uri",
"value": "{{REDIRECT_URI}}",
"description": "",
"type": "text"
}
]
},
"url": {
"raw": "https://api.amazon.com/auth/o2/token",
"protocol": "https",
"host": [
"api",
"amazon",
"com"
],
"path": [
"auth",
"o2",
"token"
]
},
"description": ""
},
"response": []
},
{
"name": "3 LWA Get Profile Information with Access Token",
"request": {
"method": "GET",
"header": [],
"body": {},
"url": {
"raw": "https://api.amazon.com/user/profile?access_token={{ACCESS_TOKEN}}",
"protocol": "https",
"host": [
"api",
"amazon",
"com"
],
"path": [
"user",
"profile"
],
"query": [
{
"key": "access_token",
"value": "{{ACCESS_TOKEN}}",
"equals": true
}
]
},
"description": ""
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "4a539264-b3e0-46d7-9ca8-0f8732bf4b27",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "7deefab7-0b21-413e-887b-9c21c20741bd",
"type": "text/javascript",
"exec": [
""
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment