[Feature Request] Read AWS IAM v4 credentials externally
- Insomnia Version: 6.0.2
- Operating System: Mac 10.13.6
Details
I often use AWS IAM v4 authentication within Insomnia. It's a pain to copy/paste these credentials into Insomnia manually especially when you have different AWS profiles and using aws_session_tokens which often rotate.
It would save lot of time if Insomnia can read the current AWS IAM credentials externally - from ~/.aws/credentials based on profile names.
👋 Thanks for opening your first issue! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. If you're requesting a feature 🎁, please provide real use cases that would benefit. 👪
To help make this a smooth process, please be sure you have first read the contributing guidelines.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This sounds like a good use-case for a custom plugin. You could create a Template Tag that reads the file and parses out the necessary contents.
Is anyone aware of a plugin implementing this ?
I just created one! insomnia-plugin-aws-iam
The magic is done by the excellent awscred library.
It works out of the box (at least for me) but more documentation, testing etc will come soon.
Awesome, thanks for sharing @dankelleher! 🤗🎁
Also added a link to it in the README
@gschier why don't we just instead fallback with getting the aws credentials from the aws sdk?
So from https://github.com/Kong/insomnia/blob/cb715f95659f917dbc8464e987cedc10cc1296f1/packages/insomnia-app/app/network/network.js#L581-L585
We could just do something like
import AWS from 'aws-sdk';
...
const {credentials: awsCreds} = AWS.config;
const credentials = {
accessKeyId: authentication.accessKeyId || awsCreds?.accessKeyId || '',
secretAccessKey: authentication.secretAccessKey || awsCreds?.secretAccessKey || '',
sessionToken: authentication.sessionToken || awsCreds?.sessionToken || ''
};
This would load whatever default credentials that the user has defined. It would also pick up a more complex setup like if they are using profiles or not.