API access via Personal Access Tokens

Hi,
so I generated a personal access token for a user. how can I put the personal access token to use? I would like to do stuff via the rest api and not send user and password for every api request. Instead I would like to use the personal access token as my authentication method.

Ist this possible? I can’t find any example in the docs or elsewhere.

Thanks a lot!

Foreman 1.23.1:

Ubuntu 16.04

Hello and welcome to the Foreman community.

The token is used as it was a regular user password. It works both in UI and API. No extra field or parameter needed. So instead of a “admin / changeme” you can login using “admin / $thetokenvalue”.

It would be awesome to describe this in our manual Foreman :: Manual, if you’re interested in contributing to our documetation, you can create a PR against this file, it’s simple markdown.

I hope that helps.

Hi Marek, thanks for the reply. Will definitely add this to the docs when I find the time to do it. Hopefully in the next few days/weeks.
Jojo

Hi again Marek,
I have another question regarding the tokens. It seems the parameter last_used_at stays None no matter how often I use a token. Is this not implemented yet?

 {u'active?': True,
               u'created_at': u'2019-12-20T16:34:08.258Z',
               u'expires_at': u'2099-12-31T13:34:48.000Z',
               u'id': 4,
               u'last_used_at': None,
               u'name': u'my_tokens_name',
               u'updated_at': u'2019-12-20T16:34:08.258Z',
               u'user_id': 47},

Sorry, I missed your reply. I think this should be considered a bug, if you can still reproduce, please open an issue.