{"id":26063917,"url":"https://github.com/jameschung/get-sso-creds","last_synced_at":"2025-07-14T00:03:53.185Z","repository":{"id":38333157,"uuid":"358736047","full_name":"JamesChung/get-sso-creds","owner":"JamesChung","description":"Interactive CLI tool to retrieve or store AWS SSO credentials based on profiles.","archived":false,"fork":false,"pushed_at":"2023-06-13T14:19:42.000Z","size":1148,"stargazers_count":6,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T09:46:49.644Z","etag":null,"topics":["aws","aws-sso","awscli","cli","sso","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JamesChung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-16T22:45:49.000Z","updated_at":"2023-02-18T23:35:12.000Z","dependencies_parsed_at":"2025-03-08T17:57:52.835Z","dependency_job_id":"46645016-541d-4734-8743-39e85e0ebd09","html_url":"https://github.com/JamesChung/get-sso-creds","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesChung%2Fget-sso-creds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesChung%2Fget-sso-creds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesChung%2Fget-sso-creds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JamesChung%2Fget-sso-creds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JamesChung","download_url":"https://codeload.github.com/JamesChung/get-sso-creds/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248406473,"owners_count":21098223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-sso","awscli","cli","sso","typescript"],"created_at":"2025-03-08T17:57:41.321Z","updated_at":"2025-04-11T13:14:20.616Z","avatar_url":"https://github.com/JamesChung.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# get-sso-creds\n\nCLI tool to get AWS SSO temporary credentials.\n\n[![Version](https://img.shields.io/npm/v/get-sso-creds)](https://npmjs.org/package/get-sso-creds)\n[![License](https://img.shields.io/npm/l/get-sso-creds)](https://github.com/JamesChung/get-sso-creds/blob/main/LICENSE)\n\n- [Prerequisites](#Prerequisites)\n- [Usage](#usage)\n\n## Prerequisites\n\nIn order for `get-sso-creds` to work properly AWS CLI v2 must be installed beforehand.\n\nAWS CLI v2\n\n\u003chttps://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html\u003e\n\n## Install\n\n```sh-session\nnpm install -g get-sso-creds\n```\n\n## Examples\n\n\u003e When developing application or scripts locally, AWS SDKs like the JavaScript `aws-sdk` or Python `boto3` will load credentials either from environment variables or the `~/.aws/credentials` file. This tool was designed to make that experience less of a hassle by allowing the user to either decide to export credentials as environment variables or by storing them in the `~/.aws/credentials` file as either `default` or as any given profile name.\n\n---\n\n\u003e Will write credentials to ~/.aws/credentials as [default]\n\n```sh-session\ngscreds select -c\n```\n\n\u003e Will write credentials to ~/.aws/credentials as [helloworld]\n\n```sh-session\ngscreds select -c --set-as=\"helloworld\"\n```\n\n\u003e Will write credentials as export statements to your clipboard which you can simply paste into your shell and press enter.\n\n```sh-session\ngscreds select -b\n```\n\n\u003e Uses credentials from the \"default\" profile to assume the role \"arn:aws:iam::996942091142:role/test-role\" with default values for session-name etc. (Review `assume` documentation to see default values).\n\n```sh-session\ngscreds assume --role=\"arn:aws:iam::996942091142:role/test-role\"\n```\n\n\u003e Uses credentials from the \"dev\" profile to assume the role \"arn:aws:iam::996942091142:role/test-role\" then sets those newly assumed credentials as the profile [helloworld] in \"~/.aws/credentials\".\n\n```sh-session\ngscreds assume --role=\"arn:aws:iam::996942091142:role/test-role\" --profile=\"dev\" -c --set-as=\"helloworld\"\n```\n\n## Commands\n\n  \u003c!-- commands --\u003e\n* [`gscreds assume`](#gscreds-assume)\n* [`gscreds clear`](#gscreds-clear)\n* [`gscreds console`](#gscreds-console)\n* [`gscreds get`](#gscreds-get)\n* [`gscreds login`](#gscreds-login)\n* [`gscreds logout`](#gscreds-logout)\n* [`gscreds ls`](#gscreds-ls)\n* [`gscreds select`](#gscreds-select)\n\n## `gscreds assume`\n\nAssumes AWS Role.\n\n```\nUSAGE\n  $ gscreds assume [--help] [--json] [-n \u003cvalue\u003e [-c | -b]] (-s \u003cvalue\u003e -r \u003cvalue\u003e) [-p \u003cvalue\u003e]\n\nFLAGS\n  -b, --clipboard             Writes credentials to clipboard.\n  -c, --credentials           Writes credentials to ~/.aws/credentials (will use [default] as the profile name if\n                              --set-as flag is not used).\n  -n, --set-as=\u003cvalue\u003e        Desired name of profile when setting credentials via --credentials flag.\n  -p, --profile=\u003cvalue\u003e       [default: default] Desired SSO config profile to use.\n  -r, --role=\u003cvalue\u003e          (required) ARN of the role to assume.\n  -s, --session-name=\u003cvalue\u003e  [default: gscreds-session] Desired name for the role session.\n  --help                      Show CLI help.\n  --json                      Outputs credentials in json format.\n\nDESCRIPTION\n  Assumes AWS Role.\n\nEXAMPLES\n  $ gscreds assume --role arn:aws:iam::996942091142:role/test-role\n\n  $ gscreds assume --role arn:aws:iam::996942091142:role/test-role -c --set-as 'my-profile'\n```\n\n_See code: [dist/commands/assume.ts](https://github.com/JamesChung/get-sso-creds/blob/v6.4.2/dist/commands/assume.ts)_\n\n## `gscreds clear`\n\nClears selected credentials in ~/.aws/credentials.\n\n```\nUSAGE\n  $ gscreds clear [--help]\n\nFLAGS\n  --help  Show CLI help.\n\nDESCRIPTION\n  Clears selected credentials in ~/.aws/credentials.\n\nEXAMPLES\n  $ gscreds clear\n  ? Select a profile: (Use arrow keys)\n  ❯ default\n    personal\n```\n\n_See code: [dist/commands/clear.ts](https://github.com/JamesChung/get-sso-creds/blob/v6.4.2/dist/commands/clear.ts)_\n\n## `gscreds console`\n\nOpens AWS Console for a selected profile.\n\n```\nUSAGE\n  $ gscreds console [--help] [-b chrome|firefox|edge]\n\nFLAGS\n  -b, --browser=\u003coption\u003e  Opens designated browser over the system default.\n\n                          Suggested values: [\"chrome\", \"firefox\", \"edge\"]\n                          \u003coptions: chrome|firefox|edge\u003e\n  --help                  Show CLI help.\n\nDESCRIPTION\n  Opens AWS Console for a selected profile.\n\nEXAMPLES\n  $ gscreds console\n  ? Select a profile: (Use arrow keys)\n  ❯ default\n    personal\n```\n\n_See code: [dist/commands/console.ts](https://github.com/JamesChung/get-sso-creds/blob/v6.4.2/dist/commands/console.ts)_\n\n## `gscreds get`\n\nGet AWS SSO credentials from existing profiles in ~/.aws/config.\n\n```\nUSAGE\n  $ gscreds get [--help] [-P [-c | -b]] [--json]\n\nFLAGS\n  -P, --preserve     Sets selected profile name as the profile name in ~/.aws/credentials when using --credentials flag.\n  -b, --clipboard    Writes credentials to clipboard.\n  -c, --credentials  Writes credentials to ~/.aws/credentials (will use default as the profile name if --preserve flag\n                     is not used).\n  --help             Show CLI help.\n  --json             Outputs credentials in json format.\n\nDESCRIPTION\n  Get AWS SSO credentials from existing profiles in ~/.aws/config.\n\nEXAMPLES\n  $ gscreds get\n  ? Select a profile: (Use arrow keys)\n  ❯ default\n    dev\n    prod\n    personal\n  Profile: my-profile\n  Credentials expire at: 6:20:24 PM\n  export AWS_ACCESS_KEY_ID=\u003cAWS_ACCESS_KEY_ID\u003e\n  export AWS_SECRET_ACCESS_KEY=\u003cAWS_SECRET_ACCESS_KEY\u003e\n  export AWS_SESSION_TOKEN=\u003cAWS_SESSION_TOKEN\u003e\n```\n\n_See code: [dist/commands/get.ts](https://github.com/JamesChung/get-sso-creds/blob/v6.4.2/dist/commands/get.ts)_\n\n## `gscreds login`\n\nInitiates AWS SSO login.\n\n```\nUSAGE\n  $ gscreds login [--help] [-p \u003cvalue\u003e]\n\nFLAGS\n  -p, --profile=\u003cvalue\u003e  [default: default] Profile name to use for login.\n  --help                 Show CLI help.\n\nDESCRIPTION\n  Initiates AWS SSO login.\n\nEXAMPLES\n  $ gscreds login --profile your-profile\n  Logging in... ⣽\n```\n\n_See code: [dist/commands/login.ts](https://github.com/JamesChung/get-sso-creds/blob/v6.4.2/dist/commands/login.ts)_\n\n## `gscreds logout`\n\nInitiates AWS SSO logout.\n\n```\nUSAGE\n  $ gscreds logout [--help] [-p \u003cvalue\u003e]\n\nFLAGS\n  -p, --profile=\u003cvalue\u003e  [default: default] Profile name to use for logout.\n  --help                 Show CLI help.\n\nDESCRIPTION\n  Initiates AWS SSO logout.\n\nEXAMPLES\n  $ gscreds logout --profile your-profile\n  Logging out... ⣽\n```\n\n_See code: [dist/commands/logout.ts](https://github.com/JamesChung/get-sso-creds/blob/v6.4.2/dist/commands/logout.ts)_\n\n## `gscreds ls`\n\nLists profile names in ~/.aws/config or ~/.aws/credentials.\n\n```\nUSAGE\n  $ gscreds ls [--help]\n\nFLAGS\n  --help  Show CLI help.\n\nDESCRIPTION\n  Lists profile names in ~/.aws/config or ~/.aws/credentials.\n\nEXAMPLES\n  $ gscreds ls\n  ? Select a file: (Use arrow keys)\n  ❯ config\n    credentials\n```\n\n_See code: [dist/commands/ls.ts](https://github.com/JamesChung/get-sso-creds/blob/v6.4.2/dist/commands/ls.ts)_\n\n## `gscreds select`\n\nGet AWS SSO credentials via AWS SSO.\n\n```\nUSAGE\n  $ gscreds select [--help] [--json] [-n \u003cvalue\u003e [-c | -b]] [-p \u003cvalue\u003e]\n\nFLAGS\n  -b, --clipboard        Writes credentials to clipboard.\n  -c, --credentials      Writes credentials to ~/.aws/credentials (will use [default] as the profile name if --set-as\n                         flag is not used).\n  -n, --set-as=\u003cvalue\u003e   Desired name of profile when setting credentials via --credentials flag.\n  -p, --profile=\u003cvalue\u003e  [default: default] Desired SSO config profile to use.\n  --help                 Show CLI help.\n  --json                 Outputs credentials in json format.\n\nDESCRIPTION\n  Get AWS SSO credentials via AWS SSO.\n\nEXAMPLES\n  $ gscreds select\n  ? Select an SSO url: (Use arrow keys)\n  ❯ https://alpha.awsapps.com/start\n    https://delta.awsapps.com/start\n  ? Select an SSO account:\n  ❯ Log archive | ctlogs@google.com | 111111111111\n    test-alpha | testalpha@yahoo.com | 222222222222\n  ? Select an SSO role: (Use arrow keys)\n  ❯ AWSServiceCatalogEndUserAccess\n    AWSAdministratorAccess\n   ...\n```\n\n_See code: [dist/commands/select.ts](https://github.com/JamesChung/get-sso-creds/blob/v6.4.2/dist/commands/select.ts)_\n\u003c!-- commandsstop --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjameschung%2Fget-sso-creds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjameschung%2Fget-sso-creds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjameschung%2Fget-sso-creds/lists"}