question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi, As I understand, for now this library don’t support GithubApps authorization?

If so, I want to discuss the best way for implementation.

In my code I used trait GithubAuth with method def getAuthHeader():String. GithubClient taken instance of GithubAuth and call this function for token. In case of PAT it’s return token from constructor, in case of private key it’s looks like:

class GithubKeyAuth(privateKeyContent: String, appId: String) extends GithubAuth {

  implicit val clock: Clock = Clock.systemUTC
  // build PrivateKey instance from string
  private val privateKey = GithubKeyAuth.getPrivateKey(privateKeyContent)

 // generate valid JWT token using PrivateKey
  override def getAuthHeader(): String = {
    "Bearer " + Jwt.encode(JwtClaim({
      s"""{"iss":$appId}"""
    }).issuedNow.expiresIn(10), privateKey, JwtAlgorithm.RS256)
  }
}

WDYT?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
loonydevcommented, Oct 1, 2020

Okay, next week I’m going to prepare this changes and will discuss it with real example.

0reactions
loonydevcommented, Nov 9, 2020

Morning @kusaeva, not yet, it’s in plan, but not in a near future. If you have a time to make it, it would be great.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authenticating with GitHub Apps
To authenticate as a GitHub App, generate a private key in PEM format and download it to your local machine. You'll use this...
Read more >
Identifying and authorizing users for GitHub Apps
When your GitHub App acts on behalf of a user, it performs user-to-server requests. These requests must be authorized with a user's access...
Read more >
Creating an OAuth App - GitHub Docs
Creating an OAuth App · In the upper-right corner of any page, click your profile photo, then click Settings. · In the left...
Read more >
Authorizing OAuth Apps - GitHub Docs
You can link to authorization information for an OAuth App so that users can review and revoke their application authorizations. To build this...
Read more >
Differences between GitHub Apps and OAuth Apps
An OAuth App acts as a GitHub user, whereas a GitHub App uses its own identity when installed on an organization or on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found