You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Use refresh_token grant type to silently refresh access tokens
- Only fall back to browser when refresh token is expired/invalid
- Track browser login times to estimate when re-auth will be needed
- Add AWS_SSO_SESSION_DURATION config for accurate estimates
- Show "browser re-auth in Xh" in status output
Copy file name to clipboardExpand all lines: README.md
+21-5Lines changed: 21 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ When using AWS SSO (Identity Center), your session tokens expire after a few hou
8
8
9
9
## The Solution
10
10
11
-
`aws-sso-refresh` runs as a background daemon and proactively refreshes your SSO sessions before they expire. It opens a browser window for re-authentication (which auto-approves if you're already logged in), so your tokens stay fresh.
11
+
`aws-sso-refresh` runs as a background daemon and proactively refreshes your SSO sessions before they expire. It uses the AWS SSO OIDC API to **silently refresh tokens** without opening a browser. Only when the underlying session has truly expired does it fall back to browser-based re-authentication.
12
12
13
13
## Installation
14
14
@@ -57,8 +57,8 @@ aws-sso-refresh help
57
57
58
58
1.**Parses** your `~/.aws/config` to find all `[sso-session]` blocks
59
59
2.**Checks** the token cache at `~/.aws/sso/cache/` for expiration times
60
-
3.**Refreshes** sessions within 30 minutes of expiring via `aws sso login --sso-session <name>`
61
-
4.**Opens a browser**for re-authentication (auto-approves if already logged in)
60
+
3.**Silently refreshes** sessions using the SSO OIDC API with the stored refresh token (no browser needed!)
61
+
4.**Falls back to browser**only when the refresh token itself has expired (rare - typically after the Identity Center session duration ends)
62
62
63
63
### Example Status Output
64
64
@@ -91,6 +91,14 @@ By default, the daemon checks sessions every 10 minutes. Customize this with:
For accurate "browser re-auth" estimates in status output, set this to match your Identity Center session duration:
97
+
98
+
```bash
99
+
export AWS_SSO_SESSION_DURATION=8 # Default: 8 hours (check with your AWS admin)
100
+
```
101
+
94
102
**Note:** After changing these values, run `aws-sso-refresh uninstall` and `aws-sso-refresh install` to update the daemon configuration.
95
103
96
104
Add these exports to your `~/.zshrc` or `~/.bashrc` to persist them.
@@ -145,9 +153,17 @@ brew install bash
145
153
2. Check the logs: `aws-sso-refresh logs`
146
154
3. Run manually to test: `aws-sso-refresh`
147
155
148
-
### Browser doesn't auto-approve
156
+
### Browser keeps opening
157
+
158
+
If the browser opens frequently for re-authentication, it means the underlying Identity Center session has expired and the refresh token can no longer silently refresh. This typically happens when:
159
+
160
+
- The session duration in AWS Identity Center is set to a short period (e.g., 1 hour)
161
+
- You've been away from your computer for longer than the session duration
162
+
- The Identity Center administrator has revoked your session
163
+
164
+
After re-authenticating in the browser once, subsequent refreshes should be silent again until the session duration expires.
149
165
150
-
Your Identity Center session may have expired. You'll need to manually approve in the browser once, then subsequent refreshes should be automatic.
166
+
**Note:** The session duration is configured by your AWS administrator in Identity Center settings (typically 8-12 hours by default, up to 7 days).
0 commit comments