<div dir="ltr"><div><div><div><div><div>Hi all,<br><br></div>There's an open bug for gnome-software about how you can't remove a snap without first logging in with your Ubuntu One credentials [1]. However, if you use the command line you can easily do this using 'sudo snap remove foo'.<br><br></div>There are a number of cases where it makes sense to be able to remove a snap without logging in:<br></div><div>- You may be offline and so can't do an Ubuntu One login at this time.<br></div>- You don't have an Ubuntu One account but you want to remove something.<br></div><div>- The snap came pre-installed, and you want to remove it. You have no need to log in and install more snaps (at that time).<br></div>- You are a different user to the one who installed it.<br><br></div><div>The reason gnome-software triggers the login is the following happens:<br></div><div>1. g-s finds the snap using GET /v2/snaps on snapd.<br></div><div>2. The user clicks "Remove"<br></div><div>3. g-s requests removal using POST /v2/snaps/[name]<br></div><div>4. snapd returns the error "login-required"<br></div><div>5. g-s prompts the user for email address / password<br></div><div>6. g-s asks the system D-Bus service snapd-login-service to login with the email address / password<br>7. snapd-login-service checks with Polkit that the user is allowed to do this<br></div><div>8. Polkit triggers a password prompt to check the user is there<br></div><div>9. snapd-login-service calls POST /v2/login on snapd<br></div><div>10. snapd returns a macaroon<br></div><div>11. snapd-login-service returns the macaroon to g-s<br></div><div>12. g-s repeats POST /v2/snaps/[name] using the macaroon<br><br></div><div>The question is - does it make sense to make a new request to snapd that gets an authorization macaroon without logging into Ubuntu One? i.e. something like this:<br><div>1. g-s finds the snap using GET /v2/snaps on snapd.<br></div><div>2. The user clicks "Remove"<br></div><div>3. g-s requests removal using POST /v2/snaps/[name]<br></div><div>4. snapd returns the error "login-required"<br></div>5. g-s asks the system D-Bus service snapd-login-service to authorize<br><div>6. snapd-login-service checks with Polkit that the user is allowed to do this<br></div><div>7. Polkit triggers a password prompt to check the user is there<br></div><div>8. snapd-login-service calls POST /v2/authorize on snapd<br></div><div>9. snapd returns a macaroon<br></div><div>10. snapd-login-service returns the macaroon to g-s<br></div><div>11. g-s repeats POST /v2/snaps/[name] using the macaroon<br></div><br></div><div>If we do this at what point do we prompt a user to do an Ubuntu One login? Do we have two error messages "auth-required" and "login-required"? Or is login an optional thing that we let the user decide if they want to do it?<br><br></div>--Robert<br><div><div><div><div><div><div><div><br>[1] <a href="https://bugs.launchpad.net/bugs/1581713">https://bugs.launchpad.net/bugs/1581713</a><br><br></div></div></div></div></div></div></div></div>