fix: keep the device polling token off the QR code
golem15.user.device_auth.auth_url gains a {short_code} placeholder and
defaults to {frontend_url}/device/scan/{short_code}; POST
/devices/authorize accepts the short code in its token field, so a scan
page that posts what its URL carries keeps working. The status poll hands
the session token over only to a client with the User-Agent the device
initiated with; another client sees the session confirmed and takes
nothing.
This commit is contained in:
@@ -202,7 +202,7 @@ func TestDeviceFlowSmoke(t *testing.T) {
|
||||
}
|
||||
|
||||
dev := initiateDevice(t, app, "Living room TV")
|
||||
if len(dev.Token) != 64 || !deviceShortCodeRE.MatchString(dev.ShortCode) || !strings.Contains(dev.AuthURL, dev.Token) || !strings.HasSuffix(dev.ExpiresAt, "+00:00") {
|
||||
if len(dev.Token) != 64 || !deviceShortCodeRE.MatchString(dev.ShortCode) || !strings.HasSuffix(dev.AuthURL, "/device/scan/"+dev.ShortCode) || strings.Contains(dev.AuthURL, dev.Token) || !strings.HasSuffix(dev.ExpiresAt, "+00:00") {
|
||||
t.Fatalf("initiate data = %+v", dev)
|
||||
}
|
||||
row := deviceRow(t, gdb, dev.Token)
|
||||
|
||||
Reference in New Issue
Block a user