Code-settings-sync: Token expired every time I make a new token

Created on 15 May 2017  ·  41Comments  ·  Source: shanalikhan/code-settings-sync

Visual Studio Code Version : 1.12.1
Code Settings Sync Version : 2.7.0
Operating System : W10 1703
Occurs On: All upload and download
Proxy Enabled: No
GIst Id: 84b5596500caa4a7da3d05261aafdfbf81c9420b

Cannot use my GIST ID to sync at all. remade and regenerated 20+ times and every single time I am receiving this error

"Sync : Invalid / Expired Github Token. Please generate new token with scopes mentioned in readme. Exception Logged in Console." or just a general "Error" and nothing happens. I am using 2FA on my github account.

Am I missing a crucial step in this?

question ❓

Most helpful comment

I've figured out how to fix it:

  1. CTRL + SHIFT + P >Sync: Reset settings
  2. CTRL + SHIFT + P >Sync: Advanced settings > Edit local settings

I believe you haven't there a key "token", so add it and put correct token data from GitHub Personal Tokens (with Gist permission).

  1. Add correct Gist ID you want to use to your personal settings.

Finally, CTRL + SHIFT + D and you're done!

I've found syncLocalSettings.json will not be removed, if you decided to remove Sync extension. And in addition, sometimes this file "forgets" about token data.

BTW: @shanalikhan, is it possible to add how-to-setup token info somewhere to your docs?

All 41 comments

Event after reset settings, I can't update the token

Ditto here. Trying to figure out my sync for nightly and LTS build of VS Code.

what are the developer console logs
Check this : https://github.com/shanalikhan/code-settings-sync/issues/177#issuecomment-269873967

Reseting Sync before issuing a new token was key for me. I guess it should go reset, gen token, then set new token. I tried to update token first, failed too many times, then got stuck in the 403 zone.

In the next release, https://github.com/shanalikhan/code-settings-sync/issues/310

You will be able to see the token also.

Well, you can see it in vscode settings under sync.gist. That was enough for me.

@cdeli , @beeblebrox3
Did that help?

No that did not work. Now I receive "Sync : Invalid / Expired Github Token. Please generate new token with scopes mentioned in readme. Exception Logged in Console." with no output log.

with no output log.

Are you sure, developer console doesnt show any error ?
As it always write error on developer console.

I'm seeing the same thing with expired GitHub token:
image

I did get this to work by doing a settings reset. I think I was also confusing the previous GIST ID that settings sync doles out with the GitHub personal access token that GitHub doles out. I did have a settings.json conflict with the file on disk and what was loaded into VSCode. I'm pretty sure I picked the file on disk as that looked like it had all the right stuff that I had uploaded via my home PC.

Still, shouldn't have run into this because I did put in the GIST ID as it asked when I first tried to sync - which worked. It was when I tried to upload some tweaked settings from this same machine that I started to get token expired errors.

I am seeing this issue too. I installed the extension yesterday on my work computer (Win7) and had it working fine, could upload settings no problem. Then I installed the plugin on my home computer (ubuntu) and could download the settings, but got the invalid github token when trying to upload settings. I ended up creating a new gist and github token, but now I cannot sync settings from my work computer, even though I'm using the correct gist id and token.

It seems to me as if resetting the extension settings does not necessarily reset the github token. At least that is what I'm seeing now when I do the following:

  • Reset extension settings
  • Regenerate github token (with gist credentials checked)
  • Attempt to download settings

So right now, the extension is not really working for me at all, which is a shame because it would otherwise be perfect.

I have released new version.
Now you can place your token manually in extension local settings.
Please try again and let me know.

Had the same issue. Regenerated a few times, reset settings and used upload but always failed.

To solve it I did the following

  1. regenerate the token
  2. reset settings + delete all the lines in settings.json with sync.*
  3. restarted VS Code
  4. upload settings

Getting the same error after updating. Nothing I do is fixing it. I am uninstalling the addon, not worth the headache.

Same as @cdeli ... sigh...

Keep getting

[Extension Host] {"message":"Bad credentials","documentation_url":"https://developer.github.com/v3"}

@cjessing have you performed the steps @Toizi performed and https://github.com/shanalikhan/code-settings-sync/issues/177#issuecomment-269873967 ?

@shanalikhan Yes I have. Even uninstalled the extension completely. No dice :-(

@cjessing actually this exception is coming from github api itself, so there is nothing we can do.
Sometimes user reports that reinstalling extension did help but actually the problem comes from github api.
What i will do from the next version is to show the token extension has saved, when connection fails.

Besides this, its on my roadmap to allow users to save this in file system , so you can import export settings to the file systems ( can be even onedrive folder if you want to sync ) so github wont be a only option to sync.

@shanalikhan Okay :-)

This is not a must have but sure is a nice extension. I'll look forward to using Google Drive to sync ;-)

@shanalikhan to provide an option rather than gist is nice. Currently, i'm frustrated about above issues :)

Not sure why they even closed this, the issue still exists.

@cdeli
I found a config file syncLocalSettings.json in my PC, and I manually update the github token.
It worked.

I resolved this problem:

  1. firstly,cmd+shift+p,and type: sync:reset
  2. sync:upload,then the vsc will open 'https://github.com/settings/tokens' automatically
  3. in this step, you should create a new gist,and copy the gist id in the vsc
    follow the above steps,you will see 'Upload Complete'
    don't open a new gist manually
    @cdeli

Nope same error.

I'm getting this error as well. Is the gist id supposed to be the sync.gist key? because I'd assume that's not an actual valid github token, just an identifier for sync. Uploading with a generated token works fine, just not downloading with the id

Is the gist id supposed to be the sync.gist key?

Yes , gist Id should be there, put gist ID there that you get from uploading on the second computer to download from the first computer settings..

Token should be in sync setting json file in Users folder.

Same issue here. I've tried resetting and creating many tokens to upload setting from my Mac. On my Linux machine, every gist I've created is invalid.

@tomanistor
Same here, but I was solved

upload setting

press ctrl+shift+p in vscode , run "sync : reset extension settings" and restart vscode .
go to "https://github.com/settings/tokens"
A : click "Generate new token"(if first time)
B : click "Edit" and click "Regenerate token",use this to upload , then it will be create new one GIST !!

download setting

press ctrl+shift+p in vscode , run "sync : reset extension settings" and restart vscode .
go to "https://gist.github.com/YourGitHubName" click "cloudSettings" , you will see GIST in url "https://gist.github.com/YourGitHubName/GIST" , use this

sorry for my bad english

@tEstCJN
I have used the gist ID. This doesn't solve the issue. When entering the gist ID, the program says that the token is expired or invalid.

I've figured out how to fix it:

  1. CTRL + SHIFT + P >Sync: Reset settings
  2. CTRL + SHIFT + P >Sync: Advanced settings > Edit local settings

I believe you haven't there a key "token", so add it and put correct token data from GitHub Personal Tokens (with Gist permission).

  1. Add correct Gist ID you want to use to your personal settings.

Finally, CTRL + SHIFT + D and you're done!

I've found syncLocalSettings.json will not be removed, if you decided to remove Sync extension. And in addition, sometimes this file "forgets" about token data.

BTW: @shanalikhan, is it possible to add how-to-setup token info somewhere to your docs?

I had the same problem for syncing my settings between Linux and Windows, I think the documents don't explain this well,
you need both Gist ID and Token to be able to sync properly.
token is in syncLocalSettings.json file
and Gist ID is in settings.json file, search for sync.gist

I followed #177(comment) and it worked perfectly for me. I'm using the latest version of VS Code 1.18.0 (I think!)
I hope that help guys!
:+1:

Part of what was confusing me was that the download setup requires both the GIST ID and the GIT token, which are separate things. You need to save both of those off somewhere if you want this to work. Maybe I'm the only stupid one, but maybe some others had the same issue I did

@victor-perov
@ali80
@tsrich

Send me pull request where you think document can be improved, i will be more happy to accept that and release the updated documentation in new version.

Hello!

Go to $HOME/Library/Application Support/Code/User/syncLocalSettings.json. and change the token!

For the people who are getting the same error as OP.
Go to this url:
https://github.com/shanalikhan/code-settings-sync#customized-sync

Pick one of the below paths for your OS:
Windows, this is %APPDATA%\Code\UsersyncLocalSettings.json.
Mac, $HOME/Library/Application Support/Code/User/syncLocalSettings.json.
Linux, ~/.config/Code/User/syncLocalSettings.json.

cd into your User folder below.
Remove the syncLocalSettings.json file

simple.

Press ctrl+p, type >Sync:Reset Extension Settings, will clear settings for setting sync , then press shift+alt+u or shift+alt+d, extension show input for again.

The easy way to reset sync personal access tokens is:
press cmd+shift+p > sync: Advanced Options > Edit Extenstion Local Settings.
Edit the token, and save.

Hi Guys,
Let me share with you how I solved this problem on my environment. [Download a existing git in different PC's]

Following these steps. maybe it could help you.

  1. ctrl+ shift + p (to open the palette) then you should write "Sync: Reset Extension Settings". this is for ensure the values are empty.

  2. Go to https://gist.github.com/<Your_UserName> and click on the gist you want to download.

  3. There you can do scroll down till you find a file named "settings.json", in this file you can get the "sync.gist" [Gist ID].

  4. Now, just go to the VSCode and press (alt+ shift + d), then, VSCode redirect you to the web page and you can select the gist file and generate the token.

Finally, you have both values, Gist ID and Token. Now, you should fill correctly inside of VSCode.

Hope the previous steps can help you. it works for me. :)

Troubleshooting page is created here.

Anyone, who has fixed the problem like users above can add information there.
https://github.com/shanalikhan/code-settings-sync/wiki/Troubleshooting

Was this page helpful?
0 / 5 - 0 ratings