Skip to content

Failed to initialize Qwen: Qwen OAuth authentication failed #821

@yshngg

Description

@yshngg

What happened?

When I run the command qwen, I encounter the error Failed to login. Message: Failed to initialize Qwen: Qwen OAuth authentication failed.

$ qwen -d
Shared token manager failed, attempting device flow: TokenManagerError: No refresh token available for token refresh
    at SharedTokenManager.performTokenRefresh (file:///Users/guoyusheng/.nvm/versions/node/v22.16.0/lib/node_modules/@qwen-code/qwen-code/node_modules/@qwen-code/qwen-code-core/dist/src/qwen/sharedTokenManager.js:352:23)
    at SharedTokenManager.getValidCredentials (file:///Users/guoyusheng/.nvm/versions/node/v22.16.0/lib/node_modules/@qwen-code/qwen-code/node_modules/@qwen-code/qwen-code-core/dist/src/qwen/sharedTokenManager.js:172:46)
    at async getQwenOAuthClient (file:///Users/guoyusheng/.nvm/versions/node/v22.16.0/lib/node_modules/@qwen-code/qwen-code/node_modules/@qwen-code/qwen-code-core/dist/src/qwen/qwenOAuth2.js:278:29)
    at async createContentGenerator (file:///Users/guoyusheng/.nvm/versions/node/v22.16.0/lib/node_modules/@qwen-code/qwen-code/node_modules/@qwen-code/qwen-code-core/dist/src/core/contentGenerator.js:119:32)
    at async GeminiClient.initialize (file:///Users/guoyusheng/.nvm/versions/node/v22.16.0/lib/node_modules/@qwen-code/qwen-code/node_modules/@qwen-code/qwen-code-core/dist/src/core/client.js:93:33)
    at async Config.refreshAuth (file:///Users/guoyusheng/.nvm/versions/node/v22.16.0/lib/node_modules/@qwen-code/qwen-code/node_modules/@qwen-code/qwen-code-core/dist/src/config/config.js:316:9)
    at async authFlow (file:///Users/guoyusheng/.nvm/versions/node/v22.16.0/lib/node_modules/@qwen-code/qwen-code/dist/src/ui/hooks/useAuthCommand.js:24:17) {
  type: 'NO_REFRESH_TOKEN',
  originalError: undefined
}
No refresh token available, proceeding with device flow
Device authorization flow failed: fetch failed

What did you expect to happen?

Qwen should be properly initialized.

Client information

Client Information

Run qwen to enter the interactive CLI, then run the /about command.

$ qwen /about
# paste output here

I can't enter the interactive CLI.

Login information

None

Anything else we need to know?

Qwen supports two authentication methods: Qwen OAuth and OpenAI. I can successfully authenticate using the OpenAI method and use the Qwen CLI without issues.

Metadata

Metadata

Labels

priority/P1High priority issuestatus/need-informationMore information is needed to resolve this issue.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions