Skip to content

Dynamically obtain token through routing requests #11566

Answered by dosubot bot
myhgc asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @myhgc! I'm here to help you out with any bugs, questions, or contributions you have. Let's squash those bugs together! 😄

Yes, you can dynamically request an interface to obtain a token and set it to the header of a request before it passes through the route using Apache APISIX. Here is how you can achieve this:

  1. Configure the backend service (upstream):

    curl "http://127.0.0.1:9180/apisix/admin/upstreams/1" -X PUT -d '
    {
      "name": "Conferences API upstream",
      "desc": "Register Conferences API as the upstream",
      "type": "roundrobin",
      "scheme": "https",
      "nodes": {
        "conferenceapi.azurewebsites.net:443": 1
      }
    }'
  2. Create a Plugin Config:

    curl "http://127.0.0.1:9180/apisix/adm…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@myhgc
Comment options

@dosubot
Comment options

@myhgc
Comment options

@myhgc
Comment options

@dosubot
Comment options

Answer selected by myhgc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant