snapcraft export-login and login command error

tf flag

I am trying to use the snapcraft export-login and login command, but I am encountering an error. After exporting my snapcraft credentials using the following command:

snapcraft export-login snaplogin

I try to login with the following command:

snapcraft login --with snaplogin

But I receive the following error message:

Cannot parse config: File contains no section headers.

I have tried checking the format of the file and the contents, but the issue still persists. I would greatly appreciate any help or advice on how to resolve this error.

Thank you in advance for your time and support. snapcraft version: snapcraft 7.2.9 snapcraft log:

2023-02-11 23:53:15.585 Traceback (most recent call last):
2023-02-11 23:53:15.585   File "/snap/snapcraft/8619/lib/python3.8/site-packages/snapcraft/store/", line 53, in _load_potentially_base64_config
2023-02-11 23:53:15.585     parser.read_string(decoded_config_content)
2023-02-11 23:53:15.585   File "/snap/snapcraft/8619/usr/lib/python3.8/", line 723, in read_string
2023-02-11 23:53:15.585     self.read_file(sfile, source)
2023-02-11 23:53:15.585   File "/snap/snapcraft/8619/usr/lib/python3.8/", line 718, in read_file
2023-02-11 23:53:15.585     self._read(f, source)
2023-02-11 23:53:15.585   File "/snap/snapcraft/8619/usr/lib/python3.8/", line 1082, in _read
2023-02-11 23:53:15.585     raise MissingSectionHeaderError(fpname, lineno, line)
2023-02-11 23:53:15.585 configparser.MissingSectionHeaderError: File contains no section headers.
David avatar
cn flag
Not seeing anything in your question that relates to this site. Are you sure this is the place for this question?
Mohammad Abbasi avatar
tf flag
Yup. my question is related to snapcraft and snap, which are part of the Ubuntu app store.
David avatar
cn flag
But not part of the Ubuntu OS which is all the volunteers here can deal with. Stackexchange main site may be a better choice or someone there can point you to the best site.
Pilot6 avatar
cn flag
@David snap questions are on-topic.
pl flag

You may also have seen this in the output:

--with is no longer supported, export the auth to the environment variable 'SNAPCRAFT_STORE_CREDENTIALS' instead

Indeed, the documentation says:

"Warning: The login --with argument is not supported in Snapcraft 7 and is currently included to help users migrate from the old authentication method to the new."

So I'd recommend using the other method detailed on that page.

export SNAPCRAFT_STORE_CREDENTIALS=$(cat snaplogin)
snapcraft whoami

Should return your logon details, for example:

email: [redacted]
username: popey
id: [redacted]
permissions: package_access, package_manage, package_metrics, package_push, package_register, package_release, package_update
channels: no restrictions
expires: 2024-02-15T10:11:42.000Z   
Mohammad Abbasi avatar
tf flag
Yes, Thank you so much.
I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.