如何从CloudFoundry获取OAuth令牌 [英] How to get OAuth token from CloudFoundry

查看:64
本文介绍了如何从CloudFoundry获取OAuth令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用curl从Cloud Foundry获取数据,但是我无法进行身份验证(针对CF的oauth)。请,有人可以指出我并举例说明如何获取oauth令牌吗?我想使用登录名和密码。

I want to get data from cloud foundry using curl, but I'm not able to authenticate (oauth against CF). Please, could someone point me to and example how to get oauth token? I want to use login name and password.

谢谢

推荐答案

这并不是您的要求,但是如果安装了最新的cf cli,则可以正常登录,然后使用 cf curl 命令运行原始请求。

This isn't exactly what you asked for, but if a recent cf cli is installed you can login as normal and then use the cf curl command to run raw requests.

例如

$ cf login (or cf auth for non-interactive login)
$ cf curl /v2/spaces/c4e73f65-4dbc-47dc-9d21-e8c566c40587/summary

要使用实际的 curl ,再次使用cf cli,请使用以下方法检索承载令牌:

To use actual curl, again using the cf cli, retrieve the bearer token with:

$ cf oauth-token

然后使用授权执行curl命令标头:

Then execute your curl command with an Authorization header:

$ curl --header 'Authorization: bearer ...' https://api.example.com/v2/spaces/c4e73f65-4dbc-47dc-9d21-e8c566c40587/summary

这篇关于如何从CloudFoundry获取OAuth令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆