Hi Everyone, I want to use a back end REST service(for exampe the service name is SendEmail). Before my API proxy hits the target endpoint SendEmail, it needs to hit another target endpoint (for example the service name is AccessToken) to get an access token string. My API proxy will then add an "Authorization" header to contain the token string and hit the SendEmail endpoint with the original REST payload from the client request.
I'd really appreciate if someone can give me help or guide me on how to do this in a single API proxy. I'm looking for advises on the following key tasks:
- Construct a get access token REST request with JSON payload.
- Call the AccessToken endpoint and capture the token string from the response, store it some where.
- Add the "Authorization" header containing the token string to the original SendEmail request.
- Call the SendEmail endpoint.
Solved! Go to Solution.
@Chung Pham you can easily achieve this by using the following policies:
Depending on your actual usecase you might even find this article to be helpful: https://docs.apigee.com/api-platform/security/oauth/use-third-party-oauth-system
@Chung Pham you can easily achieve this by using the following policies:
Depending on your actual usecase you might even find this article to be helpful: https://docs.apigee.com/api-platform/security/oauth/use-third-party-oauth-system
Thanks so much for your response, @Cladius Fernando . It helped.
@Chung Pham I'm glad my answer was helpful. Could you please convert your "answer" to a "comment" by clicking on the gear icon next to it and selecting "Convert to Comment"? Also, could you also "accept" my answer so that others with a similar question could easily figure out the correct solution. Thanks.
Thank you, @Cladius Fernando. I've accepted your answer and converted my answer to comment. I also posted another question under the subject "How to build a dynamic target end point based on an API proxy request header value ?". Could you please help if you know the answer for that ? Thanks.
Thanks @Chung Pham. I will take a look at the other question.