Skip to content

Instantly share code, notes, and snippets.

@justinm
Last active February 7, 2018 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinm/344004899868e86b1e9c9a1d66af02d8 to your computer and use it in GitHub Desktop.
Save justinm/344004899868e86b1e9c9a1d66af02d8 to your computer and use it in GitHub Desktop.
Script to support multi-terminal authentication with okta-awscli
#!/bin/bash -e
CREDENTIALS_CACHE="$HOME/.okta-credentials.cache"
if [ ! -f $CREDENTIALS_CACHE ] || test `find "$CREDENTIALS_CACHE" -mmin +120`
then
okta-awscli --cache
# If okta-awscli exits with a non-zero status code, the next line will not run
source $CREDENTIALS_CACHE
else
source $CREDENTIALS_CACHE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment