MCPcopy
hub / github.com/codeaashu/claude-code / refreshAwsAuth

Function refreshAwsAuth

src/utils/auth.ts:650–699  ·  view source on GitHub ↗
(awsAuthRefresh: string)

Source from the content-addressed store, hash-verified

648const AWS_AUTH_REFRESH_TIMEOUT_MS = 3 * 60 * 1000
649
650export function refreshAwsAuth(awsAuthRefresh: string): Promise<boolean> {
651 logForDebugging('Running AWS auth refresh command')
652 // Start tracking authentication status
653 const authStatusManager = AwsAuthStatusManager.getInstance()
654 authStatusManager.startAuthentication()
655
656 return new Promise(resolve => {
657 const refreshProc = exec(awsAuthRefresh, {
658 timeout: AWS_AUTH_REFRESH_TIMEOUT_MS,
659 })
660 refreshProc.stdout!.on('data', data => {
661 const output = data.toString().trim()
662 if (output) {
663 // Add output to status manager for UI display
664 authStatusManager.addOutput(output)
665 // Also log for debugging
666 logForDebugging(output, { level: 'debug' })
667 }
668 })
669
670 refreshProc.stderr!.on('data', data => {
671 const error = data.toString().trim()
672 if (error) {
673 authStatusManager.setError(error)
674 logForDebugging(error, { level: 'error' })
675 }
676 })
677
678 refreshProc.on('close', (code, signal) => {
679 if (code === 0) {
680 logForDebugging('AWS auth refresh completed successfully')
681 authStatusManager.endAuthentication(true)
682 void resolve(true)
683 } else {
684 const timedOut = signal === 'SIGTERM'
685 const message = timedOut
686 ? chalk.red(
687 'AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.',
688 )
689 : chalk.red(
690 'Error running awsAuthRefresh (in settings or ~/.claude.json):',
691 )
692 // biome-ignore lint/suspicious/noConsole:: intentional console output
693 console.error(message)
694 authStatusManager.endAuthentication(false)
695 void resolve(false)
696 }
697 })
698 })
699}
700
701/**
702 * Run awsCredentialExport to get credentials and set environment variables

Callers 1

runAwsAuthRefreshFunction · 0.85

Calls 11

logForDebuggingFunction · 0.85
execFunction · 0.85
startAuthenticationMethod · 0.80
onMethod · 0.80
addOutputMethod · 0.80
setErrorMethod · 0.80
endAuthenticationMethod · 0.80
resolveFunction · 0.70
toStringMethod · 0.65
getInstanceMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected