codex icon indicating copy to clipboard operation
codex copied to clipboard

Use issuer URL in device auth prompt link

Open abrar71 opened this issue 3 weeks ago β€’ 4 comments

Summary

When using device-code login with a custom issuer (--experimental_issuer), Codex correctly uses that issuer for the auth flow β€” but the terminal prompt still told users to open the default OpenAI device URL (https://auth.openai.com/codex/device). That’s confusing and can send users to the wrong domain (especially for enterprise/staging issuers). This PR updates the prompt (and related URLs) to consistently use the configured issuer. 🎯


πŸ”§ What changed

  • πŸ”— Device auth prompt link now uses the configured issuer (instead of a hard-coded OpenAI URL)
  • 🧭 Redirect callback URL is derived from the same issuer for consistency
  • 🧼 Minor cleanup: normalize the issuer base URL once and reuse it (avoids formatting quirks like trailing /)

πŸ§ͺ Repro + Before/After

▢️ Command

codex login --device-auth --experimental_issuer https://auth.example.com

❌ Before (wrong link shown)

1. Open this link in your browser and sign in to your account
   https://auth.openai.com/codex/device

βœ… After (correct link shown)

1. Open this link in your browser and sign in to your account
   https://auth.example.com/codex/device

Full example output (same as before, but with the correct URL):

Welcome to Codex [v0.72.0]
OpenAI's command-line coding agent

Follow these steps to sign in with ChatGPT using device code authorization:

1. Open this link in your browser and sign in to your account
   https://auth.example.com/codex/device

2. Enter this one-time code (expires in 15 minutes)
   BUT6-0M8K4

Device codes are a common phishing target. Never share this code.

βœ… Test plan

  • 🟦 codex login --device-auth (default issuer): output remains unchanged

  • 🟩 codex login --device-auth --experimental_issuer https://auth.example.com:

    • prompt link points to the issuer βœ…
    • callback URL is derived from the same issuer βœ…
    • no double slashes / mismatched domains βœ…

abrar71 avatar Dec 11 '25 03:12 abrar71

I have read the CLA Document and I hereby sign the CLA

abrar71 avatar Dec 11 '25 03:12 abrar71

All contributors have signed the CLA ✍️ βœ…
Posted by the CLA Assistant Lite bot.

github-actions[bot] avatar Dec 11 '25 03:12 github-actions[bot]

@codex review

etraut-openai avatar Dec 11 '25 04:12 etraut-openai

Codex Review: Didn't find any major issues. Bravo.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".