问题
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