sudo snap install A_COMMERCIAL_SNAP when not logged in gives ugly/misleading 401
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snap Store Server |
Triaged
|
Low
|
Unassigned | ||
snapd |
Triaged
|
Low
|
Unassigned |
Bug Description
$ sudo snap logout
error: not logged in # Now I'm not logged in
$ sudo snap install the-commercial-snap
error: cannot perform the following tasks:
- Download snap "the-commercial
$
The above message is misleading and ugly. Fixing this should have 2 components:
1- When sending the 401 error code, the store should send a payload indicating the full reason for the unauthorization ("login-required" comes to mind, since we don't even know if the user has purchased the snap without being logged in). This would result in a slightly protracted journey:
sudo snap install foo
"You need to be logged in"
snap login
snap install foo
"You need to buy the snap"
snap buy foo
# web flow
snap install foo
"FINALLY SUCCESS"
but let's scope this bug to the first step of that flow.
2- On receiving a 401, snapd should check and if the payload indicates login is required, nicely tell that to the user.
So this should also have a snapd task.
Of note, if any of these behaviors are already implemented, feel free to close the task for the corresponding component. IF both seem to be implemented then we have a problem somewhere :)
tags: | added: api purchasing |
Changed in snapstore: | |
importance: | Undecided → Low |
status: | New → Triaged |
Changed in snapd: | |
status: | New → Triaged |
importance: | Undecided → Low |
Currently the 401 from the store looks like this (no nice error payload):
HTTP/1.1 401 UNAUTHORIZED\ r\nContent- Length: 106\r\nContent- Type: application/ json\r\ nDate: Wed, 19 Dec 2018 21:20:30 GMT\r\nServer: gunicorn/ 19.7.1\ r\nSnap- Store-Version: 10\r\nX-Request-Id: 0AAC4142D0480A3 25CA101BB5C1AB6 1E1F83314\ r\nX-Vcs- Revision: whatever\ r\nX-View- Name: snapdevicegw. webapi_ download. snap_download\ r\n\r\n