MCPcopy Create free account
hub / github.com/oboard/claude-code-rev / refreshAwsAuth

Function refreshAwsAuth

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

Source from the content-addressed store, hash-verified

698const AWS_AUTH_REFRESH_TIMEOUT_MS = 3 * 60 * 1000
699
700export function refreshAwsAuth(awsAuthRefresh: string): Promise<boolean> {
701 logForDebugging('Running AWS auth refresh command')
702 // Start tracking authentication status
703 const authStatusManager = AwsAuthStatusManager.getInstance()
704 authStatusManager.startAuthentication()
705
706 return new Promise(resolve => {
707 const refreshProc = exec(awsAuthRefresh, {
708 timeout: AWS_AUTH_REFRESH_TIMEOUT_MS,
709 })
710 refreshProc.stdout!.on('data', data => {
711 const output = data.toString().trim()
712 if (output) {
713 // Add output to status manager for UI display
714 authStatusManager.addOutput(output)
715 // Also log for debugging
716 logForDebugging(output, { level: 'debug' })
717 }
718 })
719
720 refreshProc.stderr!.on('data', data => {
721 const error = data.toString().trim()
722 if (error) {
723 authStatusManager.setError(error)
724 logForDebugging(error, { level: 'error' })
725 }
726 })
727
728 refreshProc.on('close', (code, signal) => {
729 if (code === 0) {
730 logForDebugging('AWS auth refresh completed successfully')
731 authStatusManager.endAuthentication(true)
732 void resolve(true)
733 } else {
734 const timedOut = signal === 'SIGTERM'
735 const message = timedOut
736 ? chalk.red(
737 'AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.',
738 )
739 : chalk.red(
740 'Error running awsAuthRefresh (in settings or ~/.claude.json):',
741 )
742 // biome-ignore lint/suspicious/noConsole:: intentional console output
743 console.error(message)
744 authStatusManager.endAuthentication(false)
745 void resolve(false)
746 }
747 })
748 })
749}
750
751/**
752 * Run awsCredentialExport to get credentials and set environment variables

Callers 1

runAwsAuthRefreshFunction · 0.85

Calls 10

logForDebuggingFunction · 0.85
execFunction · 0.85
startAuthenticationMethod · 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