Calling multiple API in sequence with token in java

只愿长相守 提交于 2020-06-25 04:47:28

问题


I have to call 5 APIs in sequence after generating the token. i am using below API to generate token.

POST https://idcs-xxxx.identity.c9dev2.oc9qadev.com/oauth2/v1/token

I will send username and password to get token in above API. Once token will be received I will have to use the same token to call below 5 APIs in sequence. I will use output of one API and filter it and pick some values as an input to next API. all the rest endpoint will change based on the input value of previous API response.

GET https://idcs-xxxx.identity-t0.data.digitalassistant.oci.oc-test.com/api/v1/skills

GET https://idcs-oda-9417f93560b94eb8a2e2a4c9aac9a3ff-t0.data.digitalassistant.oci.oc-test.com/api/v1/skills/dynamicEntities

POST https://idcs-xxxx.identity-t0.data.digitalassistant.oci.oc-test.com/api/v1/bots/xxx/v2/yyy

PATCH https://idcs-xxxx.identity-t0.data.digitalassistant.oci.oc-test.com/api/v1/bots/xxx

PUT https://idcs-xxxx.identity-t0.data.digitalassistant.oci.oc-test.com/api/v1/bots/xxx/DONE

How can I automate token generation and the same token can be used in every API call. token will expire in every one hour. My only purpose is to automate above process somehow. even smallest help would be highly appreciated. you can suggest even some part of solution if not all. I could not get much material from google.


回答1:


Spring Security will help you here.

https://spring.io/blog/2018/03/06/using-spring-security-5-to-integrate-with-oauth-2-secured-services-such-as-facebook-and-github



来源:https://stackoverflow.com/questions/62538856/calling-multiple-api-in-sequence-with-token-in-java

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