keygen-cli authentication/tokens #86
fbergamelli
started this conversation in
General
Replies: 2 comments
-
You'll need to use the Rails console or API for that. Connect to the Docker container running Keygen and run the following: /app/bin/rails console Then run the following while inside of the Rails console: product = Product.create!(name: 'Test', account: Account.sole)
token = product.tokens.create!(account: Account.sole)
puts token.raw Alternatively, you can use the API, using the email and password chosen during setup: # Create an admin token
curl -X POST https://api.keygen.localhost/v1/tokens \
-u <email>:<password>
# Create a product using the new admin token (<token> = data.attributes.token from previous)
curl -X POST https://api.keygen.localhost/v1/products \
-u token:<token> \
-d '{
"data": {
"type": "product",
"attributes": {
"name": "Test"
}
}
}'
# Create a product token for the new product (<product> = data.id from previous)
curl -X POST https://api.keygen.localhost/v1/products/<product>/tokens \
-u token:<token> We're working on a new dashboard, which we'll open source soon. |
Beta Was this translation helpful? Give feedback.
0 replies
-
please ignore the last comment. It had a typo |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Finally it seems I have got the selfhosted setup working. How can I generate a product, and an API token for the product ?
It seems it's not possible using the CLI. How can I do that ?
thanks
federico
Beta Was this translation helpful? Give feedback.
All reactions