-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support OAuth 2.0 authentication #94
Comments
I'm not able to authenticate even with this workaround.
|
The linked stack overflow post is about accessing Github repositories via HTTPS and appears to be very outdated and/or confused. For Github, you need to use a Personal Access Token (PAT), and use that as password in a UsernamePasswordCredentialsProvider. This is described in the Egit User's Guide. Using a PAT with Bearer Auth won't work. |
Support for OAuth 2 authentication is growing amongst git hosting services [1]. Implementing typical OAuth authentication flows is not as simple as passing a long-term secret like a GitHub personal access token via bearer header to the application. Instead the client's request is redirected to an OAuth server where the user authenticates using long-term credentials (with a validity of months) and potentially a second factor. On successful authentication the server responds with a short-lived token (validity in the minutes) and redirects the client to the application (here github). The client needs to refresh the short-lived tokens before they expire. Git has a credentials helper API to retrieve credentials from the user or some credentials store (keychain, cache). [1] hickford/git-credential-oauth#17 |
Description
I would like the following code:
to include the following HTTP header in the dispatched request toward the Git server:
Motivation
Nowadays, OAuth 2.0 is a widespread standard for authorization. This is what is typically used by GitHub and Bitbucket.
However, JGit doesn't support this type of authentication, thus leading to troubles. Fortunately, a workaround exists but ideally it would be better to integrate directly the solution inside JGit.
Alternatives considered
The workaround which has been found:
Additional context
Related Stack Overflow question:
The text was updated successfully, but these errors were encountered: