Idea: forge.py login on a second machine signs the first one out (one OAuth grant per user); add a token sign-in #435
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot#435
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The idea
@HumanBean: signing in with
python -I scripts/forge.py loginon a second machine signs you out on the first, withinabout an hour.
Forgejo keeps one OAuth grant per user per application, and every machine signs in through the same app
(
GIT_CLIENT_IDinscripts/magicbean_login.py). In Forgejo'srouters/web/auth/oauth.go:GetGrantByUserID, line 617);InvalidateRefreshTokensis on);unauthorized_client, "token was already used" (lines827-831).
git.magicbean.dev has
InvalidateRefreshTokenson. So when machine A signs in or renews, machine B's refresh token goesstale. B keeps working until its access token runs out (
expires_in, about an hour). Then its next renewal fails:Signing in again on B does the same to A. The
_SessionLockinmagicbean_login.pyfixed this race between twoprocesses on one machine, but it can't help across machines. Seen today between a Linux PC and a Mac on the same account.
Proposed fix (a PR follows):
python -I scripts/forge.py login --token-stdintakes a Forgejo personal access token(Settings → Applications) from standard input. It is saved as the sign-in with no refresh token, so it doesn't use the
OAuth grant at all. A second machine uses a token, and the main machine keeps the Discord sign-in.
docs/forge.mdgets ashort "Two machines" section.
The alternatives are for a server admin, so they're your call:
[oauth2] INVALIDATE_REFRESH_TOKENS, which weakens refresh-token reuse detection for everyone;Anything else
Related: #420 (found while setting up the macOS port on a second machine).