snowskeleton / ynam

Mint-to-YNAB translator
Apache License 2.0
38 stars 0 forks source link

Crash during ynam --quickstart #41

Closed slamphear closed 1 year ago

slamphear commented 1 year ago

I'm getting the following crash when trying to run ynam --quickstart:

WARNING:ynam:Found error {'id': '401', 'name': 'unauthorized', 'detail': 'Unauthorized'} in response body.
Traceback (most recent call last):
  File "/usr/local/bin/ynam", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ynam/main.py", line 19, in main
    handleArgs()
  File "/usr/local/lib/python3.11/site-packages/ynam/main.py", line 58, in handleArgs
    sys.exit(run())
             ^^^^^
  File "/usr/local/lib/python3.11/site-packages/ynam/quickstart.py", line 59, in run
    budgets = ynapi.get_budgets()
              ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ynam/ynab_api.py", line 110, in get_budgets
    return self._get(url='/budgets')['budgets']
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ynam/ynab_api.py", line 93, in _get
    return self.__call(get, url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ynam/ynab_api.py", line 81, in __call
    raise Exception(jsonResults['error'])
Exception: {'id': '401', 'name': 'unauthorized', 'detail': 'Unauthorized'}

This happens after entering my Mint username (I'm entering my email address here), my Mint password, my Mint mfa seed (I copied the secret key and took out all the line breaks; is that right?), and my YNAB API key. I already set up the Mint MFA using Bitwarden – is that correct, or was I supposed to leave it at the confirmation screen and have the API confirm it?

Let me know if there's any other information that would be helpful to know here!

snowskeleton commented 1 year ago

This error indicates that YNAB doesn't like your API key. Double check that there's nothing like an extra space or something in your API key, and maybe even regenerate it with YNAB.

slamphear commented 1 year ago

Thanks, @snowskeleton! You were right; turns out the API Key is split across two lines, and I had only copied the second one. 🤦‍♂️