Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API key is not saved when using a new one #183

Open
adxsoft opened this issue Oct 18, 2022 · 9 comments
Open

API key is not saved when using a new one #183

adxsoft opened this issue Oct 18, 2022 · 9 comments

Comments

@adxsoft
Copy link

adxsoft commented Oct 18, 2022

I am using Syncthing 1.19.2 on Mac OSX High Sierra
(Note I've tried 1.20 on High Sierra without any success.

After I installed Syncthing 1.19.2 and set it to start at login, it worked perfectly syncing to two other Macs.

At some point I generated a new API Key (in the Web Gui Settings) and expected Syncthing to start at login and go Online with the green dot however Syncthing would not go online and showed the yellow Offine Indicator and the menu bar showed an exclamation mark on the Syncthing icon. After generating the new API Key, every time I started Syncthing it showed the old API key in the Preferences, even though the Web Gui Settings showed the new API Key, and stayed Offline. This mismatch between the preferences API key and the Web Gui settings API key is the issue stopping Syncthing going online.

The workaround for this issue I found was as follows

  • When Syncthing is initially installed and enabled to start at login, Mac OSX puts the APIKey in a file called 'com.github.xor-gate.syncthing-macosx.plist' in ~/Library/Preferences. For some reason this plist NEVER GETS UPDATED when a new API Key is generated
  • I edited the APIKey in 'com.github.xor-gate.syncthing-macosx.plist' to reflect the same API key that is in the Web Interface settings, restarted OSX and Syncthing went online correctly.

So I there is a bug that when the API is re-generated the new API key does not get updated into the com.github.xor-gate.syncthing-macosx.plist in ~/Library/Preferences.

Hope this helps other Mac Syncthing users.

@adxsoft adxsoft changed the title Mac OS Syncthing will not go online because 'start at login' plist never gets updated Mac OS Syncthing will not go online because 'start at login' plist never gets updated with Workaround Oct 18, 2022
@calmh
Copy link
Member

calmh commented Oct 18, 2022

This seems specific to the macOS wrapper which is a separate project, I will transfer the issue.

@calmh calmh transferred this issue from syncthing/syncthing Oct 18, 2022
@xor-gate
Copy link
Member

It seems indeed setting the API key from the preferences window doesn't save it anymore.
You could set the new api key from the commandline and restart Syncthing:

defaults write com.github.xor-gate.syncthing-macosx ApiKey '<key>'

We need to investigate why this problem exists.

@xor-gate xor-gate changed the title Mac OS Syncthing will not go online because 'start at login' plist never gets updated with Workaround API key is not saved when using a new one Oct 18, 2022
@garrett-bane-by
Copy link

I am having this issue on Mac OS Sierra 10.12.6

I used the defaults write command to write the API key and now syncthing will not start either withe the latest version or with 1.19.2-1

Do I need to generate a new API key or is there something else I need to do to remedy?

@garrett-bane-by
Copy link

I am going to try upgrading to 10.13 and see if that helps.

@xor-gate
Copy link
Member

Hi @garrett-bane-by. Syncthing saves its application files to ~/Application Support/Syncthing. The config.xml is the file where the API key is located. You could use finder to find the file: Go (from menu bar) -> Go to folder -> ~/Application Support/Syncthing and open the config.xml.

Or use the terminal with some commandline-fu:

jerry@Jerrys-iMac Syncthing % cat /Users/jerry/Library/Application\ Support/Syncthing/config.xml | grep api
        <apikey>rR7YrEDLKhNETJZKgySmnYPZvebY9qgk</apikey>

Then set it from the commandline with:

defaults write com.github.xor-gate.syncthing-macosx ApiKey '<key>'

Reinstallation will not help as the state of the syncting macOS is preserved. Hope this helps!

@xor-gate
Copy link
Member

In the same folder is also a logfile (syncthing.log) located which can be helpfull if the above doesn't help and Syncthing still doesn't start. You must make sure when you did write the api key with the defaults command to restart Syncthing macOS tray application.

@garrett-bane-by
Copy link

updating to 10.13.6 High Sierra seems to have solved the issue for now. Thank you!

@xor-gate
Copy link
Member

updating to 10.13.6 High Sierra seems to have solved the issue for now. Thank you!

I didn't expect it to work, but glad it is working for you again

@xor-gate xor-gate added the macos-10.13 High Sierra label May 29, 2023
@sudoexec
Copy link

Uninstall syncthing-macos via https://github.com/syncthing/syncthing-macos?tab=readme-ov-file#uninstallation and reinstall it, the api goes down.
Found many 403 in logs and the api key in the wrapper is different from the key in config.xml.
Still can't save api key in 12.7.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants