azuredatastudio icon indicating copy to clipboard operation
azuredatastudio copied to clipboard

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

Open ricky-1967 opened this issue 1 year ago • 18 comments

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

ricky-1967 avatar Oct 04 '23 08:10 ricky-1967

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.

WiiMusic avatar Oct 24 '23 13:10 WiiMusic

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

vladocavric avatar Oct 25 '23 15:10 vladocavric

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.

pawsaw avatar Nov 01 '23 19:11 pawsaw

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

kisantia avatar Nov 01 '23 20:11 kisantia

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.

abiyevseymur avatar Nov 16 '23 12:11 abiyevseymur

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

imgeraldalinio avatar Nov 17 '23 19:11 imgeraldalinio

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

yensubldg avatar Dec 05 '23 01:12 yensubldg

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 avatar Dec 05 '23 16:12 jwalton

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?

piratetorben avatar Jan 10 '24 09:01 piratetorben

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.

blushvoid avatar Jan 24 '24 09:01 blushvoid

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!

RayZik avatar Feb 05 '24 04:02 RayZik

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

iops avatar Feb 19 '24 10:02 iops

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

realcaldeira avatar Feb 29 '24 14:02 realcaldeira

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 avatar Mar 10 '24 12:03 SimbaNinja917

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

  1. Change Activity Bar Orientation:
  • Open your VS Code User Settings (JSON) by typing "json settings" in the command palette and selecting "Preferences: Open Settings (JSON)".
  • Add the following line to your settings: "workbench.activityBar.orientation": "vertical"
  • Click "Restart" when prompted to apply the change.
  1. Sign in to GitHub Copilot:
  • Locate the Activity Bar, now on the left side of the screen.
  • Click the account icon at the bottom of the Activity Bar.
  • Select "Sign in with GitHub to use GitHub Copilot."
  • Follow the prompts to copy your authorization code, continue to GitHub, log in, and authorize Copilot access.
  • Upon returning to VS Code, the Copilot icon should now be working correctly.

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

SimbaNinja917 avatar Mar 10 '24 12:03 SimbaNinja917

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.

rothsch avatar Mar 17 '24 09:03 rothsch

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 !

adaitran771 avatar Apr 13 '24 09:04 adaitran771

Simply reloading my window from the command palette "> Developer: Reload Window" resolved my issue.

wcooperscott avatar Aug 03 '24 15:08 wcooperscott