diff --git a/cli/cli.ts b/cli/cli.ts index b60d53d5e90e..a4251b627563 100644 --- a/cli/cli.ts +++ b/cli/cli.ts @@ -2854,7 +2854,8 @@ export function serveAsync(parsed: commandParser.ParsedCommand) { wsPort: parsed.flags["wsport"] as number || 0, hostname: parsed.flags["hostname"] as string || "", browser: parsed.flags["browser"] as string, - serial: !parsed.flags["noSerial"] && !globalConfig.noSerial + serial: !parsed.flags["noSerial"] && !globalConfig.noSerial, + noauth: parsed.flags["noauth"] as boolean || false, })) } @@ -6922,6 +6923,10 @@ ${pxt.crowdin.KEY_VARIABLE} - crowdin key aliases: ["w"], type: "number", argument: "wsport" + }, + noauth: { + description: "disable localtoken-based authentication", + aliases: ["na"], } } }, serveAsync); diff --git a/cli/server.ts b/cli/server.ts index 68da538769dd..3ed577a0ac3e 100644 --- a/cli/server.ts +++ b/cli/server.ts @@ -808,6 +808,7 @@ export interface ServeOptions { hostname?: string; wsPort?: number; serial?: boolean; + noauth?: boolean; } // can use http://localhost:3232/streams/nnngzlzxslfu for testing @@ -1089,7 +1090,7 @@ export function serveAsync(options: ServeOptions) { }) } - if (!isAuthorizedLocalRequest(req)) { + if (!options.noauth && !isAuthorizedLocalRequest(req)) { error(403); return null; }