mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-29 18:30:54 +00:00
chore: Pre-register a builtin OAuth2 application for the official Gitea mobile app (#38880)
This is a prepare and required step for upcoming Gitea Official Mobile APP which supports login with OAuth2. The official Gitea mobile app needs the same mechanism. This adds a builtin application for it: | | | |---|---| | client ID | `b757811a-05c8-4c76-8d74-a5ee3d2073f2` | | config name | `gitea-app` | | display name | `Gitea App` | | redirect URI | `com.gitea.app://oauth/callback` | Unlike the existing entries, which are CLIs and can therefore use a loopback `http://127.0.0.1` redirect, a mobile app authorises through a system browser session (`ASWebAuthenticationSession` on iOS, Custom Tabs on Android) that can only receive a custom-scheme callback, hence the custom scheme here.
This commit is contained in:
@@ -108,7 +108,7 @@ var OAuth2 = struct {
|
||||
JWTSigningAlgorithm: "RS256",
|
||||
JWTSigningPrivateKeyFile: "jwt/private.pem",
|
||||
MaxTokenLength: math.MaxInt16,
|
||||
DefaultApplications: []string{"git-credential-oauth", "git-credential-manager", "tea"},
|
||||
DefaultApplications: []string{"git-credential-oauth", "git-credential-manager", "tea", "gitea-app"},
|
||||
}
|
||||
|
||||
func loadOAuth2From(rootCfg ConfigProvider) {
|
||||
|
||||
@@ -62,7 +62,7 @@ func TestGetGeneralSigningSecretSave(t *testing.T) {
|
||||
func TestOauth2DefaultApplications(t *testing.T) {
|
||||
cfg, _ := NewConfigProviderFromData(``)
|
||||
loadOAuth2From(cfg)
|
||||
assert.Equal(t, []string{"git-credential-oauth", "git-credential-manager", "tea"}, OAuth2.DefaultApplications)
|
||||
assert.Equal(t, []string{"git-credential-oauth", "git-credential-manager", "tea", "gitea-app"}, OAuth2.DefaultApplications)
|
||||
|
||||
cfg, _ = NewConfigProviderFromData(`[oauth2]
|
||||
DEFAULT_APPLICATIONS = tea
|
||||
|
||||
Reference in New Issue
Block a user