azure-sdk-for-js: [Bug] InteractiveBrowserCredential not failing in non-interactive environments

  • Package Name: @azure/identity
  • Package Version: 2.1.0
  • Operating system: MacOS 12.4
  • nodejs
    • version: 16.14.0
  • browser
    • name/version:
  • typescript
    • version:
  • Is the bug related to documentation in

Describe the bug When using InteractiveBrowserCredential in a non-UI or non-interactive environment (CI, GitHub Actions…) it’s stuck waiting indefinitely for an interactive login. When using ChainedTokenCredential, I would expect it to fail and fall back to the next credentials method chained.

To Reproduce Steps to reproduce the behavior:

  1. Set up an app to log in with something like this:
  const browserCredential = new InteractiveBrowserCredential({
    redirectUri: `http://localhost:31337`
  });
  1. Try to run the app in a Docker container, for example.

Expected behavior InteractiveBrowserCredential fails because of non-UI or non-interactive environment.

Additional context Because of this issue, in SWA CLI (https://github.com/Azure/static-web-apps) the app never fall back to using DeviceTokenCredential in non-UI environment or gets CI stuck indefinitely in non-interactive environments.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 16 (14 by maintainers)

Most upvoted comments

That would be helpful I think for solving this! Another option would be to propose a PR to fix the issue in open as negative error codes are not considered errors.

https://github.com/sindresorhus/open/pull/296