Target URL with Basic Auth

Hi,

I’ve just installed Tyk for testing.

My API Target URL has Basic Auth “Security” - how can I pass the credentials?
When I define “Target URL” with “http://user:[email protected]” it’s not working and I have no other fields to enter details.

Do you have any ideas?

Thanks in advance and have a great Sunday.

Sascha

Hi

You send the base64 encoded username and password in the Authorization header of the request in the format basic b64(username: password)

See the docs for more information https://tyk.io/docs/security/your-apis/basic-auth/

Thanks
Josh

Hi Josh,

thank you for the fast reply.

I think I’m too stupid to understand - what I tried:

  1. API Designer
    -> Authentication Mode ( Basic )
    -> Strip Authorization Data
    -> Advanced Options -> Global Version -> Add this Header ( Name: Authorization, Value: Basic klajdflasiowe… )
  2. The same as one with no Authentication Mode
  3. The same with Strip Auth Data not marked
  4. Edited JSON added
    “basic_auth_data”: {
    “password”: “mickey-mouse”
    }

Nothing worked - I just don’t understand it.

Can you please give my any hint?

Hi

  1. Add new API and set auth mode to basic auth then save
  2. add new key and check this as username for basic authentication and enter the username and password that will be used for basic auth - you can change any other properties such as rate limiting etc your want associated with the key at this point - and save
  3. It’s all setup so now call api i.e.

curl -H ‘Authorization: basic b64(u:p)’ my_domain:8080/basicauth