Re: How to retrieve session token via rest api?

2018-08-02 Thread Aleksandar Kostadinov

Hi,

I have a blog about it [1]. HTH

[1] http://rboci.blogspot.com/2015/07/openshift-v3-rest-api-usage.html

Yu Wei wrote on 08/01/18 12:24:

Hi guys,

I could get session token via cli "oc whoami -t".

Could I get the same information via rest api?

I tried with api below, however, it returned many tokens.

Is there any method to filter that?

curl -k \
     -H "Authorization: Bearer 
yqqouu8vFaip9AjMChmcgdtY7AszXMxWWJHwWhpn8Lw" \

     -H 'Accept: application/json' \
https://10.1.241.54:8443/oapi/v1/oauthaccesstokens

Thanks,

Jared



___
users mailing list
users@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users



___
users mailing list
users@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users


Re: How to retrieve session token via rest api?

2018-08-02 Thread Graham Dumpleton
You can see what commands do by adding '--loglevel 9' option.

oc whoami -t --loglevel 9

What you will find in this case though is that for that token in particular it 
doesn't actually make any API calls, as all it is doing is getting it from the 
~/.kube/config file.

What do you want to use the token for? There may be more appropriate ways of 
creating a token you can use.

Graham

> On 1 Aug 2018, at 2:54 pm, Yu Wei  wrote:
> 
> Hi guys,
> 
> I could get session token via cli "oc whoami -t".
> 
> Could I get the same information via rest api?
> 
> I tried with api below, however, it returned many tokens. 
> Is there any method to filter that?
> curl -k \
> -H "Authorization: Bearer yqqouu8vFaip9AjMChmcgdtY7AszXMxWWJHwWhpn8Lw" \
> -H 'Accept: application/json' \
> https://10.1.241.54:8443/oapi/v1/oauthaccesstokens 
> 
> Thanks,
> 
> Jared
> ___
> users mailing list
> users@lists.openshift.redhat.com
> http://lists.openshift.redhat.com/openshiftmm/listinfo/users

___
users mailing list
users@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users


How to retrieve session token via rest api?

2018-08-01 Thread Yu Wei
Hi guys,

I could get session token via cli "oc whoami -t".

Could I get the same information via rest api?

I tried with api below, however, it returned many tokens.

Is there any method to filter that?

curl -k \
-H "Authorization: Bearer yqqouu8vFaip9AjMChmcgdtY7AszXMxWWJHwWhpn8Lw" \
-H 'Accept: application/json' \
https://10.1.241.54:8443/oapi/v1/oauthaccesstokens

Thanks,

Jared
___
users mailing list
users@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users