Bearer token API?

Is there a way to retrieve bearer token of project owner for Rancher API using API or CLI?
I found them on WebUI but couldn’t find them on API or CLI documentation.

The UI is a 100% client-side API client. Anything it can do you can do through the API by definition. This is just sort of an odd case because API/CLI access is gated by already having a token in the first place.

curl -u <existing token for a user> -X POST -H 'Content-Type: application/json' -d '{}' https://your-rancher/v3/tokens

1 Like

Thank you for your suggestion.

In that example you mentioned, admin can retrieve a new token using an old token. How about getting token of the other user? (eg admin can get token of project A owner foo. )

And, if I should find the answer, where the /v3/tokens endpoint usage/format/spec? I couldn’t find it either github rancher/api-spec or Rancher 1.6 API v2 doc.

Users cannot create (or get) tokens for other users.

The api-spec is a generic description of the “style” of all APIs that we implement; it has nothing to do with any particular product and is not really meant to be user-facing documentation, it’s for someone implementing a client or compliant server.

The v2[-beta] API is for 1.x, Rancher 2 is v3. There are no docs pages, but the were just generated from all the same schemas and such you can see clicking around the API in a browser.

1 Like

Thank you so much. I will find that (the same) schemas.