Hello, I am using Kratos for user login and sessio...
# ory-selfhosting
d
Hello, I am using Kratos for user login and session handling. I also have a need to authenticate robots via API keys or tokens (that are not OAuth). Is this something that I can somehow pull of via Kratos or should I be using some other method? I have figured that I can create a fake account, login to it, and generate an infinitely long JWT that can be used for this purpose, but this seems like an extreme hack.
d
As far as I understand, every kratos session has to be created by user interaction; so you can’t do things like issue a long-lived API key for a user. But is this something you really need? You could maintain a list of valid API keys and authorize against them separately?
d
I was hoping to use a common authentication for both users and api keys.
h
Copy code
flow=$(curl -s -X GET -H "Accept: application/json" "https://$host/self-service/login/api" | jq -r '.id')

session_token=$(curl -s -X POST -H  "Accept: application/json" -H "Content-Type: application/json" -d '{"password_identifier": "<mailto:bot@domain.com|bot@domain.com>",  "password": "mypass", "method": "password"}' "https://$host/self-service/login?flow=$flow" | jq -r '.session_token')