Skip to content

Conversation

@samcoe
Copy link
Contributor

@samcoe samcoe commented Mar 9, 2023

Fixes #7112

Due to a regression in our auth flow we were trying to retrieve the current user name before setting the authentication token, so the request was failing as unauthenticated. This changes how we retrieve the current user name to specify the auth token. The most direct way to do this was to manually create a http request rather than using the api client as before. The api client does not have any clean way to inject an auth token or header unfortunately. Note that this regression only applied to users who paste in their auth token during login.

@samcoe samcoe requested a review from a team as a code owner March 9, 2023 00:40
@samcoe samcoe self-assigned this Mar 9, 2023
@samcoe samcoe requested review from mislav and vilmibm and removed request for a team March 9, 2023 00:40
return add.SSHKeyUpload(httpClient, hostname, f, title)
}

func getCurrentLogin(httpClient httpClient, hostname, authToken string) (string, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more or less equivalent to what happens in api.CurrentLoginName which is why no test changes were necessary.

@samcoe samcoe merged commit 50ddb36 into trunk Mar 9, 2023
@samcoe samcoe deleted the fix-pats branch March 9, 2023 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot use personal access token to authenticate with v2.24.0

3 participants