+3
-1
atproto/client/admin_auth.go
+3
-1
atproto/client/admin_auth.go
···
2
2
3
3
import (
4
4
"net/http"
5
+
6
+
"github.com/bluesky-social/indigo/atproto/syntax"
5
7
)
6
8
7
9
type AdminAuth struct {
8
10
Password string
9
11
}
10
12
11
-
func (a *AdminAuth) DoWithAuth(c *http.Client, req *http.Request) (*http.Response, error) {
13
+
func (a *AdminAuth) DoWithAuth(c *http.Client, req *http.Request, endpoint syntax.NSID) (*http.Response, error) {
12
14
req.SetBasicAuth("admin", a.Password)
13
15
return c.Do(req)
14
16
}
+3
-2
atproto/client/apiclient.go
+3
-2
atproto/client/apiclient.go
···
11
11
)
12
12
13
13
type AuthMethod interface {
14
-
DoWithAuth(c *http.Client, req *http.Request) (*http.Response, error)
14
+
// endpoint parameter is included for auth methods which need to include the NSID in authorization tokens
15
+
DoWithAuth(c *http.Client, req *http.Request, endpoint syntax.NSID) (*http.Response, error)
15
16
}
16
17
17
18
type APIClient struct {
···
137
138
138
139
var resp *http.Response
139
140
if c.Auth != nil {
140
-
resp, err = c.Auth.DoWithAuth(c.Client, httpReq)
141
+
resp, err = c.Auth.DoWithAuth(c.Client, httpReq, req.Endpoint)
141
142
} else {
142
143
resp, err = c.Client.Do(httpReq)
143
144
}
+1
-1
atproto/client/password_auth.go
+1
-1
atproto/client/password_auth.go
···
43
43
}
44
44
}
45
45
46
-
func (a *PasswordAuth) DoWithAuth(c *http.Client, req *http.Request) (*http.Response, error) {
46
+
func (a *PasswordAuth) DoWithAuth(c *http.Client, req *http.Request, endpoint syntax.NSID) (*http.Response, error) {
47
47
accessToken, refreshToken := a.GetTokens()
48
48
req.Header.Set("Authorization", "Bearer "+accessToken)
49
49
resp, err := c.Do(req)