Commit 8753023
feat(auth): Add refreshUserData function for profile sync
Implements Option 2 (Token Refresh on Profile Page) for immediate
profile updates without requiring sign out/in.
Changes:
1. Added refreshUserData() function to AuthContext
- Fetches fresh user data from /oauth2/userinfo endpoint
- Returns Promise<boolean> for success/failure handling
- Updates session state with latest user information
2. Updated AUTH.md documentation
- Added refreshUserData to available properties
- New example: ProfilePage with auto-refresh on mount
- New example: Manual refresh button
- Use case explanation for profile synchronization
Usage:
```tsx
const { refreshUserData } = useAuth();
// Auto-refresh on page load
useEffect(() => {
refreshUserData();
}, []);
// Manual refresh
await refreshUserData();
```
Benefits:
- ✅ Immediate profile updates (no 6-hour token expiry wait)
- ✅ No sign out/in required
- ✅ Fresh data on demand
- ✅ Better UX for profile management
Related: Auth server profile edit page (auth-server commits)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent b0cad69 commit 8753023
2 files changed
+92
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
171 | 222 | | |
172 | 223 | | |
173 | 224 | | |
174 | 225 | | |
175 | 226 | | |
176 | 227 | | |
177 | 228 | | |
| 229 | + | |
178 | 230 | | |
179 | 231 | | |
180 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
174 | 207 | | |
175 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
176 | 214 | | |
177 | 215 | | |
178 | 216 | | |
| |||
0 commit comments