GithubApp Auth
See original GitHub issueHi, 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:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay, next week I’m going to prepare this changes and will discuss it with real example.
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.