-
Notifications
You must be signed in to change notification settings - Fork 31
add option to pass access token in a header #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add option to pass access token in a header #6
Conversation
jayair
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this. This looks great. Just a couple of questions and pointers. Let me know what you think.
index.js
Outdated
| console.log("Getting temporary credentials"); | ||
|
|
||
| var logins = {}; | ||
| const { idToken, accessToken } = userTokens; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use vanilla JS here? Just so we can support most versions of Node.
index.js
Outdated
| status: result.status, | ||
| statusText: result.statusText, | ||
| data: result.data | ||
| data: JSON.stringify(result.data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was leaving it as an object since Node does a good job of formatting objects in the console. Any reason why you wanted to stringify it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey it seems that when I don't stringify I just get the top level properties of the result displayed and I wanted to see the full (deep) object. I'm hitting a graphql endpoint so the response looks like this:
Authenticating with User Pool
Getting temporary credentials
Making API request
{ status: 200,
statusText: 'OK',
data:
{ data: { vendors: [Array] },
extensions: { tracing: [Object] } } }
The interesting part of the result is in that Array. I can switch this back to not use stringify but maybe it should be another option.
index.js
Outdated
| status: result.response.status, | ||
| statusText: result.response.statusText, | ||
| data: result.response.data | ||
| data: JSON.stringify(result.response.data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah just checking why the need to stringify.
… stringify output
|
Awesome! Thanks. |
This adds an option 'access-token-header' to allow the user to set a HTTP header on which to pass the access token along with the request. This is required when using a custom authorizer as described here: https://aws.amazon.com/blogs/mobile/integrating-amazon-cognito-user-pools-with-api-gateway/.