nerdishbynature / octokit.swift

A Swift API Client for GitHub and GitHub Enterprise
MIT License
488 stars 126 forks source link

Unauthorised with fetching repos with config #92

Closed skywinder closed 1 year ago

skywinder commented 4 years ago
            let config = TokenConfiguration(GITHUB_TOKEN)
            let gh = Octokit(config)
            gh.repository(owner: owner, name: name) { response in
              switch response {
              case .success(let repository):
                stars = repository.stargazersCount
                if let unwrapped = stars {
                    print("\(name) : \(unwrapped)⭐️")
                }
                break
              case .failure(let error):
                print(error)
                break

              }

this code works fine without token (but with token gets error:

Error Domain=com.nerdishbynature.octokit Code=401 "(null)" UserInfo={RequestKitErrorKey={
    "documentation_url" = "https://developer.github.com/v3";
    message = "Bad credentials";
}}

I tried to send the same token by curl - everything works fine.

pietbrauer commented 4 years ago

Which scopes does your token have?

I just tried it and it works like it should.

pietbrauer commented 1 year ago

Closing because of no activity for almost 2 years.