Skip to content

Commit b0cb68a

Browse files
committed
fix(auth): fix device code login crash
Two bugs prevented 'ado login --method device' from working: 1. The Microsoft identity platform device code API response uses 'verification_url' (not 'verification_uri'), causing a WithClauseError on the pattern match in request_device_code/1. 2. CLI.color/2 returns an IO list (not a string), so string interpolation in login_device_code/1 raised ArgumentError. Fixed by passing the color list directly to CLI.writeln/1 as an IO list. Verified locally against the live Microsoft identity platform.
1 parent cae1fe9 commit b0cb68a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/ado_cli/auth.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ defmodule AdoCli.Auth do
124124
{:ok, device_code, user_code, verification_uri, interval} ->
125125
CLI.writeln("")
126126
CLI.writeln("To sign in, use a web browser to open:")
127-
CLI.writeln(" #{CLI.color(verification_uri, :cyan)}")
127+
CLI.writeln([" ", CLI.color(verification_uri, :cyan)])
128128
CLI.writeln("")
129-
CLI.writeln("And enter the code: #{CLI.color(user_code, :green)}")
129+
CLI.writeln(["And enter the code: ", CLI.color(user_code, :green)])
130130
CLI.writeln("")
131131

132132
case poll_for_token(org, device_code, interval, 0) do
@@ -442,7 +442,7 @@ defmodule AdoCli.Auth do
442442
with {:ok, %Finch.Response{status: 200, body: resp_body}} <-
443443
Finch.request(request, AdoCli.Finch),
444444
{:ok,
445-
%{"device_code" => dc, "user_code" => uc, "verification_uri" => vu, "interval" => iv}} <-
445+
%{"device_code" => dc, "user_code" => uc, "verification_url" => vu, "interval" => iv}} <-
446446
JSON.decode(resp_body) do
447447
{:ok, dc, uc, vu, iv}
448448
else

0 commit comments

Comments
 (0)