Skip to content

Error passing in empty token #754

@geowa4

Description

@geowa4

In osdctl, the code passes both the access token and the refresh token when calling connectionBuilder.Tokens. If in the code below, a long-lived offline access token is set as config.AccessToken and config.RefreshToken is set to an empty string (because it is not needed), the API will generate an error.

connectionBuilder.Tokens(config.AccessToken, config.RefreshToken)
Get \"https://api.stage.openshift.com/api/clusters_mgmt/v1/clusters?search=omitted&size=50\": can't get access token: invalid_grant: Invalid refresh token

There may not be a reason to pass in the refresh token since the user of osdctl could log in again to generate a new temporary access token or only use the long-lived offline access token so I will likely propose that change on that repository. However, I personally believe it would be beneficial for the API to ignore empty tokens and the SDK to ignore (or warn) when passed empty strings.

I am willing to make that change to the SDK, but I wanted to ask the maintainers first so let me know your thoughts. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions