Obtain Auth-Token from Keyrock Fiware API

≡放荡痞女 提交于 2019-12-06 04:39:35

Short answer:

The IdM Keyrock API requires authentication for most of its endpoints, so you should actually generate a token. How to generate a token is something more complicated that needs some background to be explained. If you are using the official IdM keyrock GE I totally recommend you to watch this tutorial about this component in Fiware Academy. It explains among other things how to generate an OAuth2 token using an OAuth2 client and the IdM keyrock.

Long answer:

The GE IdM Keyrock consists of two projects: Horizon and Keystone. Both are forks of Openstack projects that you can find in Github. When you consume services to port 8000 you are calling Horizon services which is the frontend component. On the other hand when you consume services to port 5000 you are calling Keystone services which is the backend component. By the way if you are looking for more info about this APIs you could find it here:

The tricky part is that while keystone handles its own internal tokens (keystone tokens), FIWARE uses OAuth2 tokens to integrate with other GEs. For this reason you will find OAuth2 extensions within the keyrock APIs. So, depending on which API you want to consume, what kind of token you will need: Keystone token or OAuth2 token.

For example, if you want to retrieve the existing users using the following service, you will need a Keytone token.

GET http://localhost:5000/v3/users

Finally, to generate a keystone token you could use the following service of the keystone API:

POST http://[keyrock_host]:5000/v3/auth/tokens 
{ "auth": {
    "identity": {
      "methods": ["password"],
      "password": {
        "user": {
          "name": [ADMIN_USER],
          "domain": { "name": "default" },
          "password": [ADMIN_PWD]
        }
      }
    }
  }
}

If you installed Keyrock from Docker Hub image or even from the official source code repository try with "idm" for ADMIN_USER and ADMIN_PWD.

I hope I have been helpful. Good luck with the tesis!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!