Skip to content

Commit

Permalink
docs(readme): Add example request
Browse files Browse the repository at this point in the history
Add example request to show how to send the bearer token
  • Loading branch information
niallmccullagh committed Sep 7, 2018
1 parent 7f0c92d commit f7f4bb5
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

[![NPM version](https://badge.fury.io/js/exegesis-cognito.svg)](https://www.npmjs.com/package/exegesis-cognito)
[![Build Status](https://travis-ci.org/niallmccullagh/exegesis-cognito.svg)](https://travis-ci.org/niallmccullagh/exegesis-cognito)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![Greenkeeper badge](https://badges.greenkeeper.io/niallmccullagh/exegesis-cognito.svg)](https://greenkeeper.io/)
[![Coverage Status](https://coveralls.io/repos/github/niallmccullagh/exegesis-cognito/badge.svg?branch=master)](https://coveralls.io/github/niallmccullagh/exegesis-cognito?branch=master)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Greenkeeper badge](https://badges.greenkeeper.io/niallmccullagh/exegesis-cognito.svg)](https://greenkeeper.io/)

This package provides authentication of AWS cognito tokens in Exegesis requests.

Expand All @@ -22,7 +24,7 @@ async function createServer() {
{
// Other options go here...
authenticators: {
bearerAuth: exegesisCognito( { jwks})
bearerAuth: exegesisCognito( { jwks })
}
}
));
Expand Down Expand Up @@ -115,4 +117,15 @@ or access token.
"username": "niall"
}
}
```
```

## Sending a request

The client must send the access/id token in the Authorization header when making requests to protected resources.
For example,

```bash
curl -X GET \
'http://localhost:3000/things' \
-H 'Authorization: Bearer eyJraWQiOiJpaGZYSVQ4Uk4yeFwvQW15UVo0Z2FUdEw5T3ZqQVpQa3RUcHY4SUpTbWttaz0iLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJiYTViY2Y3Mi00YjIwLTRjMDYtYmM2Yi1mZmM3MTBhZGIyNDQiLCJhdWQiOiIyNzh2b2EwY3UzM2Mxa3VlODJyYTYycTY1cSIsImNvZ25pdG86Z3JvdXBzIjpbIm15Z3JvdXAiXSwiZW1haWxfdmVyaWZpZWQiOnRydWUsImV2ZW50X2lkIjoiMzI4NDRkNDgtYjFkZC0xMWU4LWE0NzQtMDVhN2YwNzQzYmE3IiwidG9rZW5fdXNlIjoiaWQiLCJhdXRoX3RpbWUiOjE1MzYyNDI0MjIsImlzcyI6Imh0dHBzOlwvXC9jb2duaXRvLWlkcC51cy1lYXN0LTEuYW1hem9uYXdzLmNvbVwvdXMtZWFzdC0xX1RFU1QiLCJjb2duaXRvOnVzZXJuYW1lIjoiamFuZSIsImV4cCI6MTUzNjI0NjAyMiwiaWF0IjoxNTM2MjQyNDIyLCJlbWFpbCI6ImphbmVAZC5vZSJ9.IdZV1F0MxEU0eC_6Qe_98EjgMSgYEGhP-mwqZtzQb4L8U1jOw-hnK4J1REChsaOatffE-aOJ4uoLV4oPYedRqnX4ABJ9XueN3lWfcZHc_DE2RTvDuEAV7hHoNTZwwn_mgaaYwLNMMOJeciXu3iM7PeT7xJAjdCxcdczZi1hPpqBc9Yx9wM7EMHyEo5klov3zRPJyvFPEpQPgpG1TjNkuvFwcl848YaXQDdlS9rXtTOySBVQu913e3i25VBnxZGxeHpFO3mmUomefOprDEvZpBSPg3-Di4F2-vKDzIl1OT98J8GayrJnD39O1TMUdiW-ApZKBFydtJtqvydQoVmEo_g'
```

0 comments on commit f7f4bb5

Please sign in to comment.