-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate GitHub OAuth App to GitHub App
Ref #11780
- Loading branch information
Showing
6 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from allauth.socialaccount.providers.github.provider import GitHubProvider | ||
from readthedocs.allauth.providers.githubapp.views import GitHubAppOAuth2Adapter | ||
|
||
|
||
class GitHubAppProvider(GitHubProvider): | ||
id = "githubapp" | ||
name = "GitHub App" | ||
oauth2_adapter_class = GitHubAppOAuth2Adapter | ||
|
||
provider_classes = [GitHubAppProvider] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns | ||
|
||
from readthedocs.allauth.providers.githubapp.provider import GitHubAppProvider | ||
|
||
|
||
urlpatterns = default_urlpatterns(GitHubAppProvider) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from allauth.socialaccount.providers.github.views import GitHubOAuth2Adapter | ||
|
||
from allauth.socialaccount.providers.oauth2.views import ( | ||
OAuth2CallbackView, | ||
OAuth2LoginView, | ||
) | ||
|
||
class GitHubAppOAuth2Adapter(GitHubOAuth2Adapter): | ||
provider_id = 'githubapp' | ||
|
||
|
||
oauth2_login = OAuth2LoginView.adapter_view(GitHubAppOAuth2Adapter) | ||
oauth2_callback = OAuth2CallbackView.adapter_view(GitHubAppOAuth2Adapter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters