c.UI.Error(fmt.Sprintf("Error storing token in %q keyring: %s",keyringType,err))
gotErr=true
break
}
}
if!gotErr{
c.UI.Output("\nThe token was successfully stored in the chosen keyring and is not displayed here.")
}
}
}
switch{
casegotErr:
c.UI.Warn(fmt.Sprintf("The token was not successfully saved to a system keyring. The token is:\n\n%s\n\nIt must be manually passed in via the BOUNDARY_TOKEN env var or -token flag. Storing the token can also be disabled via -keyring-type=none.",token.Token))
casec.FlagKeyringType=="none":
c.UI.Warn("\nStoring the token in a keyring was disabled. The token is:")
return"",fmt.Errorf("Error looking up primary auth method in scope '%s': got '%s' but the command requires an auth method prefix of '%s'. Make sure the sub command you're using matches the primary auth method type in the scope being used. For example, if using the password sub command the primary auth method must have a prefix of 'ampw'.\n\nSee 'boundary authenticate -h' for available sub command usage.",scopeId,m.Id,amType)
}
returnm.Id,nil
}
}
return"",fmt.Errorf("Primary auth method not found for scope ID: '%s'. Please set a primary auth method on this scope or pass one explicitly using an authenticate sub command (see 'boundary authenticate -h') along with the -auth-method-id flag.",scopeId)