1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-08-06 22:13:02 +02:00

Added basic auth support to the library

This commit is contained in:
Florian Krauthan
2017-02-08 14:37:57 -08:00
parent 8a4b1aca33
commit cf2bcefedb
3 changed files with 101 additions and 17 deletions

View File

@ -70,9 +70,41 @@ func main() {
}
```
### Authenticate with session cookie
### Authenticate with jira
Some actions require an authenticated user.
#### Authenticate with basic auth
Here is an example with a basic auth authentification.
```go
package main
import (
"fmt"
"github.com/andygrunwald/go-jira"
)
func main() {
jiraClient, err := jira.NewClient(nil, "https://your.jira-instance.com/")
if err != nil {
panic(err)
}
jiraClient.Authentication.SetBasicAuth("username", "password")
issue, _, err := jiraClient.Issue.Get("SYS-5156", nil)
if err != nil {
panic(err)
}
fmt.Printf("%s: %+v\n", issue.Key, issue.Fields.Summary)
}
```
#### Authenticate with session cookie
Here is an example with a session cookie authentification.
```go