Comments (12)
thanks @fedefernandez! we'll give it a try.
cc @thijsnissen
from github4s.
Okay, next week I'm going to prepare this changes and will discuss it with real example.
from github4s.
You're right we don't support github apps authorization.
However, I'm not sure about the best way to go about it as we don't want to handle jwt tokens directly in the library for example.
from github4s.
Agreed, maybe we can make GithubClient
to accept instance of GithubAuth
, so the user can use by default GithubPatAuth
, in other cases they need to define own class.
But if it's part of Github Auth flow user will do same code over and over.
from github4s.
So, do you have any suggestions how to implement it?
I can do that, by I need to be sure that I don't waste a time.
from github4s.
maybe we can make GithubClient to accept instance of GithubAuth, so the user can use by default GithubPatAuth, in other cases they need to define own class.
I'm 👍 on that
from github4s.
But as I mention before, users will do same code over and over and not in the best way. It's like give them domain and say, use own http sender.
from github4s.
We can add that code as documentation, it doesn't seem to me like the usage will be so huge that it would need to be part of the library.
from github4s.
@loonydev Hi! Are you still planning to make a PR with this changes?
from github4s.
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.
from github4s.
Hello - I'm interested about the status of this issue
We have a standalone service in our infrastructure that requires broad access to GH's REST api and the repositories under our organisation (DHL-Parcel) - preferably using the github4s library and authorise not via a personal access token - but either via JWT tokens or - as requested in this issue - via GH Apps authorisation.
We did try the new AccessToken
feature to get this working but weren't able to. The main issue seems to be the Authorisation: token
header being hardcoded in the library, but we might not understand the way the new features was intended to be used. In that case an example would help us.
If authorisation via JWT or GH App tokens is currently not possible we would able to spend some time on getting this to work with github4s provided that we get some help and pointers on how the preferred integration should look like in the API.
Thanks in advance :)
from github4s.
Hi @nmcb, thanks for your interest.
This is how it's currently built.
We have an algebra that allows generating tokens:
This algebra has a single implementation called StaticAccessToken
. You pass a token, and it returns as a pure value.
When you create a new Github4s
client, it's creates an instance of that algebra to use it internally:
This is then used to create the internal GithubAPIv3
algebra:
That, in a similar way, pass it to the internal HTTPClient
algebra:
The HTTPClient
uses the withAccessToken
to get the token and pass it to the RequestBuilder
The RequestBuilder
stores the token in a authHeader
map, where the key is Authorization
, and the value is s"token $token"
.
This is mapped to a Header.Raw
Potential solution
@loonydev's approach looks good, so I've created a draft with a potential solution:
In that way, you can implement your algebra for generating auth headers, having complete control. Let me know your thoughts. The docs need to be updated accordingly.
from github4s.
Related Issues (20)
- Github4s not returning complete information about members of an organization HOT 3
- Receive 422 response when searching Issues HOT 6
- Ignore the reviewers test HOT 1
- Remove Auth.newAuth as it has been discontinued
- Repository doesn't contain a parent HOT 1
- "/" not accepted in searchRepos 's query HOT 8
- Update codebase to cats-effect 3 HOT 3
- ScalaJS artifacts for Scala 2.13 and Scala 3 HOT 4
- Support for error "Moved Permanently" HOT 2
- patch field being String in FileComparison causing compareCommit to crash HOT 1
- GET /search/code supported? HOT 2
- Flaky tests
- patch field being String in FileComparison causing compareCommit to crash
- List followers of a user HOT 3
- Support for Scala Native
- Flaky test `Repos >> ListStatus`
- bad documentation URL in github enterprise HOT 1
- Support merging of a pull request HOT 1
- Support reference deletion HOT 1
- Support retrieving auth user's email
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from github4s.