{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Adapter for Envoy
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • 日本語コミュニティ
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • General /
avatar image
0
Question by Rohan Jangid · Feb 17 at 01:19 PM · 33 Views apigee edgeapi proxyapigee

How to make an api call where dynamically pass access token in (Get verb)

once we generate an access token using client credentials grant type (In post verb) something like this

after this in Get verb whenever client hit on another api then user got response and internally dynamically allocated to access token in header

for this this i created a proxy called as PC-Demo-1 with the verify access token(OAuth2.0) and in this proxy i passed basepath https://mocktarget.apigee.net/json

and in another api proxy i set as no target point and inside this i generated access token

and now i want i don't type access token i want whenever i hit on pc-demo-2-oauth2 api with grant type etc . and its verify and then if i hit on pc-demo-1 i got response

screenshot-134.png (222.8 kB)
screenshot-135.png (219.4 kB)
screenshot-136.png (162.3 kB)
screenshot-137.png (148.1 kB)
Comment
Add comment
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Close

1 Answer

  • Sort: 
avatar image
1

Answer by Priyadarshi Ajitav Jena · Feb 17 at 04:22 PM

Ok, it seems you want to automate in postman.

What you can do is select one environment.

In the first api request in postman, under tests write

var data = JSON.parse(responseBody);
postman.setEnvironmentVariable("access_token_ad", data.access_token);

this will set the access_token's value in body to environment.

In the second api

in the Authorization value place write

Basic {{access_token_ad}}

this will automatically take the value. You need not to enter manually in second api request in postman.

Comment
Add comment Show 7 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Rohan Jangid · Feb 17 at 04:50 PM 0
Link

sir but i want like my access token is stored in a variable after this somehow in first api's header is attached with access token in header may be we can do this thing using assign message policy and Extract variable

avatar image Priyadarshi Ajitav Jena Rohan Jangid · Feb 17 at 04:59 PM 1
Link

That is a bad practice. Oauth 2.0 is know for its two legged and 3 legged nature.

If still you want then just store in cache of your app and use until it expires. This is something we have implemented.

If you want to set inside proxy, I would suggest to store in Apigee cache and use.

But if you want to do a service callout and get the token from its response and send to the backend it can be done but not a a good practice.

avatar image Rohan Jangid Priyadarshi Ajitav Jena · Feb 17 at 05:04 PM 0
Link

"But if you want to do a service callout and get the token from its response and send to the backend it can be done but not a a good practice." exactly i want this i knew it's bad practice i am exploring thing how it is work so can you suggest me how can i do this

could you please drop your mail-id

Show more comments

Follow this Question

Answers Answers and Comments

138 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Getting fault string as "Failed to execute JavaCallout. null" while executing java callout 5 Answers

Creating a dynamic proxy route using http request with {variables}. Adding route variables to the request proxy 2 Answers

How to support target pre and post flow in shared-flow in apigee ? 1 Answer

how to display developer details when ever we hit on api it should be display in body 1 Answer

how to validate if header attributes has spaces ex- "Cache-Control" and : 1 Answer

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2021 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Adapter for Envoy
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • 日本語コミュニティ
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Badges