#445 Add API checking to set-distgit-token and set-pagure-token
Closed: Won't fix by jkunstle. Opened by jkunstle.

User ought to receive a "good API token" confirmation when they update their token in their config via set-distgit-token or set-pagure-token. This could be a GET request or whatever else. Additionally, since the user needs to specify which ACL's they include on their key, it would be nice if the ACL's attached to that key were also displayed by this check (unsure if the Pagure API supports this.


I am afraid Pagure's API doesn't support (at least for anybody who is not admin) operations with keys (including reading its settings). What we can do is making a simple request (with the current key) and based on the response we can determine (or estimate?) whether the key is invalid or valid. Of course, even with a valid key, it is not assured you will successfully perform the required operation (ACLs could be wrong).
The check can be done before the operation (request new repo or branch, do a fork). In case of negative response, we can show a hint to a user on how to get a valid new key. The same hint can be shown in the case of no key present in the configuration.

That makes sense logistically. In that case, the solution to this will be making a simple request with the current key and estimating the validity of the current key based on the response, as you said. Thank you very much for your analysis of the Pagure API capabilities.

Metadata Update from @jkunstle:
- Issue close_status updated to: Won't fix
- Issue status updated to: Closed (was: Open)

Metadata