Update authorization for PAT to be Bearer as documented (#3039)

This commit is contained in:
Nikola Jokic 2023-11-07 14:19:53 +01:00 committed by GitHub
parent 62eca94e45
commit 2646456677
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -6,7 +6,6 @@ import (
"crypto/sha256" "crypto/sha256"
"crypto/tls" "crypto/tls"
"crypto/x509" "crypto/x509"
"encoding/base64"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io" "io"
@ -835,8 +834,7 @@ func (c *Client) getRunnerRegistrationToken(ctx context.Context) (*registrationT
bearerToken := "" bearerToken := ""
if c.creds.Token != "" { if c.creds.Token != "" {
encodedToken := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("github:%v", c.creds.Token))) bearerToken = fmt.Sprintf("Bearer %v", c.creds.Token)
bearerToken = fmt.Sprintf("Basic %v", encodedToken)
} else { } else {
accessToken, err := c.fetchAccessToken(ctx, c.config.ConfigURL.String(), c.creds.AppCreds) accessToken, err := c.fetchAccessToken(ctx, c.config.ConfigURL.String(), c.creds.AppCreds)
if err != nil { if err != nil {