You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The api.User() panics with the invalid memory address error.
It looks like the cause of the error stems from the getUserEndpoint() as it returns the path as "/rest/api/user/" where as it should return the path as "/rest/api/user?" ?
Hi @c-seeger - I see when the username and the token are not blank, the authentication being performed is "Basic"
func (r *Request) SetBasicAuth(username, password string) {
r.Header.Set("Authorization", "Basic "+basicAuth(username, password))
}
func (a *API) Auth(req *http.Request) {
//Supports unauthenticated access to confluence:
//if username and token are not set, do not add authorization header
if a.username != "" && a.token != "" {
req.SetBasicAuth(a.username, a.token)
}
}
So the token based auth (OAuth) is not supported ?
The api.User() panics with the invalid memory address error.
It looks like the cause of the error stems from the getUserEndpoint() as it returns the path as "/rest/api/user/" where as it should return the path as "/rest/api/user?" ?
Because according to the https://developer.atlassian.com/cloud/confluence/rest/api-group-users/#api-api-user-get, see the '?' in the url
the below works perfectly ok.
curl -v -k -X GET 'https://confluence.go.com/rest/api/user?username={gouser}' -H "Authorization: OAuth gousertoken"
{ "type": "known", "username": "GoUser", "userKey": "40282be65460e1310154be02974f2376", "profilePicture": { "path": "/images/icons/profilepics/default.svg", "width": 48, "height": 48, "isDefault": true }, "displayName": "Go Confluence User", "_links": { "base": "https://confluence.go.com", "context": "", "self": "https://confluence.go.com/rest/api/user?key=40282be65460e1310154be02974f2376" } }
Expected behavior
The api.User() should ok.
Release version
1.3.2
Additional context
The code that produces the error is below for your reference -
main.go.txt
Any help is appreciated.
The text was updated successfully, but these errors were encountered: