我正在关注Fiware上下文代理介绍以获取令牌: https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Publish/Subscribe_Broker_-_Orion_Context_Broker_-_Quick_Start_for_Programmers
我收到了剧本:
$ wget --no-check-certificate https://raw.githubusercontent.com/fgalan/oauth2-example-orion-client/master/token_script.sh
我按照说明运行它:
$ bash token_script.sh
用户名:[我有效的软件电子邮件帐户]
密码:[我的有效软件帐户密码]
但它不会返回任何访问令牌。实际上,它没有返回任何东西,没有组织,没有id,没有名字....(我有一个组织)
我在Fiware云实例(Ubuntu 14.04)中运行脚本
更新:
这里是按要求运行脚本的详细信息:
root @ ubuntu:〜#bash -x token_script.sh + echo''
+ read -p 'Username: ' USER
Username: vicens@datalook.io
+ read -s -p 'Password: ' PASSWORD
Password: + echo ''
++ curl -s -d '{"auth": {"passwordCredentials": {"username":"vicens@datalook.io", "password”:”xxxxxxxx”}}}’ '-HContent- type: application/json' http://cloud.lab.fi-ware.org:4730/v2.0/tokens
+ RESP=
++ sed 's/{"access":{"token":{.*"id":"\(.*\)"},"user.*$/\1/g'
++ echo
+ TOKEN=
+ echo -e '\nAccess Token: '
Access Token:
++ curl -s '-Hx-auth-token: ' http://cloud.lab.fi- ware.org:4730/v2.0/tenants
+ ORGS=
+ echo -e '\nOrganizations: '
Organizations:
+ set ORGS2=
+ awk -v k=text '{printf("%-32s %s \n", "ID", "Name"); n=split($0,a," [{}]"); for (i=1; i<=n; i++) {m=split(a[i], b, "[,:\"]"); if (m>=15) printf("%-32s %s \n", b[9], b[15])}}'
+ echo
ID Name
+ echo ''
+ read -p 'Select an organization from the list above (ID): ' ORG
Select an organization from the list above (ID):
+ BODY='{"auth": {"token":{"id": ""}, "tenantId": ""}}'
++ curl -s -X POST -H 'Content-Type: application/json' -d '{"auth": {"token":{"id": ""}, "tenantId": ""}}' http://cloud.lab.fi-ware.org:4730/v2.0/tokens
+ RESP1=
++ sed 's/{"access":{"token":{.*"id":"\(.*\)","tenant.*$/\1/g'
++ echo
+ TOKEN=
+ echo -e '\nToken: '
Token:
+ echo ''
干杯, 维桑。
答案 0 :(得分:0)
我做了同样的测试。在可能的情况下:
当电子邮件和/或密码错误时,我会收到以下RESP行:
+ RESP='User credentials not authorized'
当我介绍正确的电子邮件和密码时,我会看到以下RESP行:
+ RESP='{"access":{"token":{"expires":"2015-07-09T15:16:07Z","id":"IxxxxWBY0uTT1jjrKfTvq9KKBl_GiCoaNMExhM6PX1bH-ZeeoCzCVkA0uzWLZ8LTKE4MG6VxARAY1MEaYqr2Rg"},"user":{"username":"fermin","roles_links":[],"id":"fermin","name":"Fermin"}}}'
因此,我无法重现问题并获得您获得的空RESP行(+ RESP=
)。
可能是由于某些网络问题,安全组件暂时不可用或某种其他故障。