docs: mark MintAPIToken deprecated in favour of MintAPITokenFor

This commit is contained in:
2026-10-23 21:16:47 +02:00
parent ebe408f542
commit 98924041c9
2 changed files with 5 additions and 1 deletions

View File

@@ -52,6 +52,10 @@ func APITokenPrefix(app *backpack.App) (string, error) {
// callers, every member token scope a catalog compiled in this process
// declared (CompileAPITokenScopes). New code calls MintAPITokenFor, which
// checks the scopes against the application's own catalog.
//
// Deprecated: the declared-scope fallback is process-wide, so in a process
// that boots several applications it accepts another application's scopes.
// Use MintAPITokenFor.
func MintAPIToken(prefix string, userID uint, name string, scopes []string, expiresAt *time.Time, collectionIDs []uint) (string, *models.APIToken, error) {
return mintAPIToken(prefix, userID, name, scopes, expiresAt, collectionIDs, func(scope string) bool {
return slices.Contains(AllowedAPITokenScopes, scope) || declaredScopes.has(scope)