#5420 API endpoint to verify token validity
Opened a year ago by mattia. Modified 7 months ago

I have a script that fetches a list of tickets from Pagure, do some work which requires a lot of time, and finally closes some of those tickets.
The issue is that if I forgot to check my API token validity before running the script, I might waste a lot of time just to start it again. Is there some way to check if the token is valid at the very start of the script?


I have a script that fetches a list of tickets from Pagure, do some work which requires a lot of time, and finally closes some of those tickets.
The issue is that if I forgot to check my API token validity before running the script, I might waste a lot of time just to start it again. Is there some way to check if the token is valid at the very start of the script?

Not per-se at the moment. Would you be able to check its validity by performing
a request with it first?

Sure, can you point me to an example GET request endpoint which requires a token to be valid?

Arg, it looks like my reply didn't make it here. There is already such endpoint, check the "Who am I?" endpoint under "Extras": https://pagure.io/api/0/#extras-tab

Arg, it looks like my reply didn't make it here. There is already such endpoint, check the "Who am I?" endpoint under "Extras": https://pagure.io/api/0/#extras-tab

Oh, I see. Yes, for my purposes that would be sufficient.
Do you think #5422 is worth to be finalized? As a difference with the "Who am I?" endpoint, it will check if a token is valid for a specific project, not just valid per se.

I'll leave this to the current maintainers of the project :)

Arg, it looks like my reply didn't make it here. There is already such endpoint, check the "Who am I?" endpoint under "Extras": https://pagure.io/api/0/#extras-tab

Oh, I see. Yes, for my purposes that would be sufficient.
Do you think #5422 is worth to be finalized? As a difference with the "Who am I?" endpoint, it will check if a token is valid for a specific project, not just valid per se.

I'll leave this to the current maintainers of the project :)

We don't currently have per-project API tokens, nor has anyone actually asked for that yet. But if it was something someone was interested in adding to Pagure, then this API would be useful for that purpose.

So I guess the basis of consideration should be built on that.

We don't currently have per-project API tokens,

We do :)
Depending on where you generate your API token (in the user's settings page or
in the project's settings page), the token will be cross-project or
project-specific :)

Oh whoops, you're right. Then we probably do want this API endpoint.

Metadata Update from @wombelix:
- Issue set to the milestone: 6.0

8 months ago

Metadata Update from @wombelix:
- Issue tagged with: RFE, easyfix

7 months ago

Log in to comment on this ticket.

Metadata