summaryrefslogtreecommitdiff
path: root/internal/api/auth/authorize.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2025-04-19 21:57:50 +0200
committerLibravatar GitHub <noreply@github.com>2025-04-19 21:57:50 +0200
commite9f6d186dc947863a5dfc18c8d6f2016b8030c88 (patch)
treedb2c4737aeeb52f93fda69591bf957815948145d /internal/api/auth/authorize.go
parent[chore] Little settings panel report view tweak (#4025) (diff)
downloadgotosocial-e9f6d186dc947863a5dfc18c8d6f2016b8030c88.tar.xz
[bugfix] Fix '+'-separated scopes not being recognized (#4028)
* [bugfix] Fix '+'-separated scopes not being recognized * comment
Diffstat (limited to 'internal/api/auth/authorize.go')
-rw-r--r--internal/api/auth/authorize.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/internal/api/auth/authorize.go b/internal/api/auth/authorize.go
index 3676fd417..5b3e6ea3c 100644
--- a/internal/api/auth/authorize.go
+++ b/internal/api/auth/authorize.go
@@ -20,6 +20,7 @@ package auth
import (
"net/http"
"net/url"
+ "strings"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
@@ -229,8 +230,8 @@ func (m *Module) AuthorizePOSTHandler(c *gin.Context) {
}
// redirectAuthFormToSignIn binds an OAuthAuthorize form,
-// stores the values in the form into the session, and
-// redirects the user to the sign in page.
+// presumed to be set as url query params, stores the values
+// into the session, and redirects the user to the sign in page.
func (m *Module) redirectAuthFormToSignIn(c *gin.Context) {
s := sessions.Default(c)
@@ -240,9 +241,14 @@ func (m *Module) redirectAuthFormToSignIn(c *gin.Context) {
return
}
- // Set default scope to read.
+ // If scope isn't set default to read.
+ //
+ // Else massage submitted scope(s) from
+ // '+'-separated to space-separated.
if form.Scope == "" {
form.Scope = "read"
+ } else {
+ form.Scope = strings.ReplaceAll(form.Scope, "+", " ")
}
// Save these values from the form so we