microsoft / azuredatastudio

Azure Data Studio is a data management and development tool with connectivity to popular cloud and on-premises databases. Azure Data Studio supports Windows, macOS, and Linux, with immediate capability to connect to Azure SQL and SQL Server. Browse the extension library for more database support options including MySQL, PostgreSQL, and MongoDB.
https://learn.microsoft.com/sql/azure-data-studio
MIT License
7.5k stars 882 forks source link

Failed to get copilot token due to 401 status. Please sign out and try again #24578

Open ricky-1967 opened 9 months ago

ricky-1967 commented 9 months ago

Type: Bug

Hi, I've tried signing out and back in from VS STudio, I'm still facing this issue. It was working fine on my perssonal account when on a trial period.

My organization has given me a license now my activation is failing on Data Studio , but is OK on VS STudio

[INFO] [auth] [2023-10-04T08:52:42.704Z] Failed to get copilot token due to 401 status. Please sign out and try again. [ERROR] [default] [2023-10-04T08:52:42.706Z] GitHub Copilot could not connect to server. Extension activation failed: "Your GitHub token is invalid. Please sign out from your GitHub account using VSCode UI and try again."

Azure Data Studio version: azuredatastudio 1.46.0 (39449bbe88a0bc4092c9b205cad10d0a556beffd, 2023-09-16T01:40:10.706Z) OS version: Windows_NT x64 10.0.19045 Restricted Mode: No Preview Features: Enabled Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz (12 x 2712)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.61GB (20.33GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Extensions (12) Extension|Author (truncated)|Version ---|---|--- copilot|Git|1.95.239 admin-pack|Mic|0.0.2 agent|Mic|0.49.0 arc|Mic|1.8.0 azcli|Mic|1.8.0 dacpac|Mic|1.14.0 import|Mic|1.5.5 machine-learning|Mic|0.12.0 profiler|Mic|0.14.0 schema-compare|Mic|1.21.0 sql-database-projects|Mic|1.3.1 sql-migration|Mic|1.4.9
WiiMusic commented 8 months ago

I am currently experiencing the same issue. I tried many different methods to log off and log back in (via VSCode UI) but alas, nothing works.

vladocavric commented 8 months ago

I have the same issue on one device but on another, it works as expected.

pawsaw commented 8 months ago

Got this today on the VS Code Insiders and the regular VS Code version. As this is an extension for a paid feature (GitHub Copilot individual/ enterprise) I would expect to get a (hot-)fix for this asap and not in February @kisantia. Co-Pilot is practically not usable.

I tried rm -Rf ~/.vscode and a fresh installation: nothing works.

kisantia commented 8 months ago

@lewis-sanchez please take a look into this when you get a chance

abiyevseymur commented 7 months ago

Hi I am using Cursor and experienced with same issue. I tried to log off from VS code and log in again but nothing worked.

imgeraldalinio commented 7 months ago

Same issue in my local

[INFO] [auth] [2023-11-17T19:04:58.191Z] Failed to get copilot token due to 401 status. Please sign out and try again.
[ERROR] [default] [2023-11-17T19:04:58.194Z] Extension activation failed: "Failed to get copilot token due to 401 status. Please sign out and try again."

Solution:

I realized that my Visual Studio Code was already signed in to my existing account. Therefore, I needed to log out in order to sign back in with the account where my Copilot subscription is enabled. image

yensubldg commented 7 months ago

I have the same issue, and try to sign in again but not working

Same issue in my local

[INFO] [auth] [2023-11-17T19:04:58.191Z] Failed to get copilot token due to 401 status. Please sign out and try again.
[ERROR] [default] [2023-11-17T19:04:58.194Z] Extension activation failed: "Failed to get copilot token due to 401 status. Please sign out and try again."

Solution:

I realized that my Visual Studio Code was already signed in to my existing account. Therefore, I needed to log out in order to sign back in with the account where my Copilot subscription is enabled. image

jwalton commented 7 months ago

Here's how I got this working on my machine:

image
piratetorben commented 5 months ago

VS code remove the Account icon. Hence, I removed the authentication from my github account. Since then I am logged out, but I can no longer sign-in with my github work account. If I 1) click on the "settings" icon, 2)click on "Backup and Settings" 3) click on "Sign in" it suggests me my legacy github account and there is no way to sign in with another account. Is there any way to log in with my new work github account?

blushvoid commented 5 months ago

Hi I am using Cursor and experienced with same issue. I tried to log off from VS code and log in again but nothing worked.

Have you managed to resolve it on Cursor? I have the same issue for a month. Even weirder on VS code it works fine, it's just cursor.

RayZik commented 5 months ago

Here's how I got this working on my machine:

  • In the left bar at the bottom, there's an icon above the settings icon that looks like a little person (this is the "Accounts" icon). Click on this.
  • Click on "username (GitHub)" then "Sign Out"
  • Click on the Github Copilot icon in the tray at the bottom, and pick "Sign in to GitHub". This will either open a browser to make you sign in, or it might make an alert popup with a buttom that will let you sign into GitHub (inexplicably requiring two clicks).
  • After signing in, the Copilot icon should lose the "!" and copilot should start working.
image

Thanks! It works for me!

iops commented 4 months ago

I was signed in to two different github accounts. signed out of one and restart fixed the problem

realcaldeira commented 4 months ago

install an older version of copilot that works, I currently have v1.168.0

SimbaNinja917 commented 3 months ago

Here's how I got this working on my machine:

  • In the left bar at the bottom, there's an icon above the settings icon that looks like a little person (this is the "Accounts" icon). Click on this.
  • Click on "username (GitHub)" then "Sign Out"
  • Click on the Github Copilot icon in the tray at the bottom, and pick "Sign in to GitHub". This will either open a browser to make you sign in, or it might make an alert popup with a buttom that will let you sign into GitHub (inexplicably requiring two clicks).
  • After signing in, the Copilot icon should lose the "!" and copilot should start working.
image

@jwalton this doesn't work for Cursor. I have the same issue as @blushvoid Cursor doesn't have the "Profile icon" on the bottom left. Clicking on the copilot on the bottom right and "signin" doesn't open a window but show two error toasts: "Your GitHub token is invalid. Please sign out from your GitHub account using the VS Code accounts menu and try again." and "Extension activation failed: "Failed to get copilot token due to 401 status. Please sign out and try again.""

@realcaldeira in Cursor Installing the older version of copilot didn't help.

Anyone has been able to fix this in Cursor ?

SimbaNinja917 commented 3 months ago

Addendum: 2024-03-10 14:43:49 I was able to find a fix @jwalton @realcaldeira @blushvoid @abiyevseymur:

1) Change Activity Bar Orientation:

2) Sign in to GitHub Copilot:

Open your VS Code User Settings (JSON) by typing "json settings" in the command palette and selecting "Preferences: Open Settings (JSON)". 01a

Add the following line to your settings: "workbench.activityBar.orientation": "vertical" 02

Click "Restart" when prompted to apply the change. 03

Click the account icon at the bottom of the Activity Bar and select "Sign in with GitHub to use GitHub Copilot." 04a

Follow the prompts to copy your authorization code, continue to GitHub, log in, and authorize Copilot access. 05

the Copilot icon should now be working correctly 06

rothsch commented 3 months ago

Type: Bug

Hi, I've tried signing out and back in from VS STudio, I'm still facing this issue. It was working fine on my perssonal account when on a trial period.

My organization has given me a license now my activation is failing on Data Studio , but is OK on VS STudio

[INFO] [auth] [2023-10-04T08:52:42.704Z] Failed to get copilot token due to 401 status. Please sign out and try again. [ERROR] [default] [2023-10-04T08:52:42.706Z] GitHub Copilot could not connect to server. Extension activation failed: "Your GitHub token is invalid. Please sign out from your GitHub account using VSCode UI and try again."

Azure Data Studio version: azuredatastudio 1.46.0 (39449bb, 2023-09-16T01:40:10.706Z) OS version: Windows_NT x64 10.0.19045 Restricted Mode: No Preview Features: Enabled Modes:

System Info Extensions (12)

I log out and re log in the github account of visual studio code and it works.

adaitran771 commented 2 months ago

Type: Bug

Hi, I've tried signing out and back in from VS STudio, I'm still facing this issue. It was working fine on my perssonal account when on a trial period.

My organization has given me a license now my activation is failing on Data Studio , but is OK on VS STudio

[INFO] [auth] [2023-10-04T08:52:42.704Z] Failed to get copilot token due to 401 status. Please sign out and try again. [ERROR] [default] [2023-10-04T08:52:42.706Z] GitHub Copilot could not connect to server. Extension activation failed: "Your GitHub token is invalid. Please sign out from your GitHub account using VSCode UI and try again."

Azure Data Studio version: azuredatastudio 1.46.0 (39449bb, 2023-09-16T01:40:10.706Z) OS version: Windows_NT x64 10.0.19045 Restricted Mode: No Preview Features: Enabled Modes:

System Info Extensions (12)

  • I encountered this problem and I tried to uninstall azure... and folder in C:\Users{Username}\AppData\Roaming\Azuredatastudio. Then I reinstalled azure and the problem was solved !