obtaining a token akeneo

langladed
Participant I

Hello,

I am a begginner on apigee.

I want to connect a proxy to an api from akeneo.

I have to generat a token for using it during the rest of the process.

To get a valid token, the client application must send the following request:

curl -X POST http://your-host/api/oauth/v1/token \
        -H "Content-Type: application/json" \
        -H "Authorization: Basic YOUR_BASE_64_CLIENT_ID_AND_SECRET" \
        -d '{
            "grant_type": "password",
            "username": "your_API_username",
            "password": "its_password"
        }'

I try to do this with apigee but impossible to find a solution.

Could you please explain my how doing this with an example.

Thanks a lot

0 6 163
6 REPLIES 6

Assuming Apigee is supposed to be the client side of this OAuth transaction, you probably want something like this:

https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/outbound-oauth

This uses a JS callout to fetch the token but you could also use a Service Callout instead.

Exactly, thank you.

I look at it in detail

one other detail please.

I try to adapt this script on my apigee envrionnement but i have a comprehension problem concerning the cache envrionnement.

I "only" creat a cache on apigee name "oauth-token-cache".

But this don't work. And i don't understand how used oauth-token-cache.xml ?

Do i have to use it this my api client (i use postman) ?

thanks for your help.

I'm not clear on your question. You've created a cache.

???

And then what?

You said "this don't work." what exactly did not work? Can you describe:

  • what you tried
  • what results you were expecting to see
  • what results you actually saw

Maybe we can help you.

Also what specifically are you attempting to do? Why did you create a cache? What are you hoping to cache?

Elaborate.

A "cache" is basically a container to put entries in. The cache created by oauth-token-cache.xml is used by the proxy outbound-oauth to put access tokens in. See eg: https://github.com/apigee/api-platform-samples/blob/master/sample-proxies/outbound-oauth/apiproxy/po... which sets the cache to

<CacheResource>oauth-token-cache</CacheResource>

Hence using the proxy as defined in this sample requires this cache to have been created.

I'm not sure what you tried to do and what didn't work, but that's how it's expected to work.

perfect thanks a lot