Skip to content

Commit

Permalink
Check error when init sts client
Browse files Browse the repository at this point in the history
  • Loading branch information
mozillazg committed Dec 3, 2021
1 parent cecce87 commit eeb79fa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/credentials/oidctoken/oidctoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,13 @@ func (p *RoleProvider) retrieve(ctx context.Context) (*Credential, error) {

func AssumeRoleWithOIDCToken(ctx context.Context, providerArn, roleArn, token, stsEndpoint, stsProtocol, policy, roleSessionName string,
sessionDuration time.Duration) (*Credential, error) {
stsClient, _ := sts.NewClient(&openapi.Config{
stsClient, err := sts.NewClient(&openapi.Config{
Endpoint: tea.String(stsEndpoint),
Protocol: tea.String(stsProtocol),
})
if err != nil {
return nil, err
}
sessionName := roleSessionName
if sessionName == "" {
sessionName = fmt.Sprintf("%d", time.Now().UnixNano())
Expand Down

0 comments on commit eeb79fa

Please sign in to comment.