How to create a basic auth key with custom username using Advanced Management API?


#1

Imported Google Group message. Original thread at: https://groups.google.com/forum/#!topic/tyk-community-support/E9Qt1yXHee0 Import Date: 2016-01-19 21:42:14 +0000.
Sender:Daniele Motta.
Date:Thursday, 7 January 2016 11:26:26 UTC.

Hi, anyone know how to create a key with custom username using Advanced Management API? The API auto-generate the username as part of the key_id, but i want set my custom username.
Any suggestions?


#2

Imported Google Group message.
Sender:Martin Buhr.
Date:Thursday, 7 January 2016 13:04:28 UTC.

Hi Danielle,

Yep - there’s an undocumented endpoint for that:

POST /api/apis/keys/basic/test_username HTTP/1.1
Host: domain.com:PORT
Connection: keep-alive
Content-Length: 416
authorization: e94d9792-f5c5-4e9a-5eae-df12255e739b

{
“last_check”: 0,
“allowance”: 1000,
“rate”: 1000,
“per”: 1,
“expires”: 1452177621,
“quota_max”: -1,
“quota_renews”: 1452171681,
“quota_remaining”: 0,
“quota_renewal_rate”: 60,
“access_rights”: {
“16daffbca6f3442e67b456dc452f9313”: {
“api_id”: “16daffbca6f3442e67b456dc452f9313”,
“api_name”: “Test API”,
“versions”: [“Default”]
}
},
“apply_policy_id”: “”,
“tags”: [],
“jwt_data”: {
“secret”: “”
},
“meta_data”: {},
“basic_auth_data”: {
“password”: “password”
}
}

Cheers,
Martin

On Thursday, January 7, 2016 at 11:26:26 AM UTC, Daniele Motta wrote:
Hi, anyone know how to create a key with custom username using Advanced Management API? The API auto-generate the username as part of the key_id, but i want set my custom username.
Any suggestions?


#3

Imported Google Group message.
Sender:Daniele Motta.
Date:Thursday, 7 January 2016 13:04:28 UTC.

Hi Danielle,

Yep - there’s an undocumented endpoint for that:

POST /api/apis/keys/basic/test_username HTTP/1.1
Host: domain.com:PORT
Connection: keep-alive
Content-Length: 416
authorization: e94d9792-f5c5-4e9a-5eae-df12255e739b

{
“last_check”: 0,
“allowance”: 1000,
“rate”: 1000,
“per”: 1,
“expires”: 1452177621,
“quota_max”: -1,
“quota_renews”: 1452171681,
“quota_remaining”: 0,
“quota_renewal_rate”: 60,
“access_rights”: {
“16daffbca6f3442e67b456dc452f9313”: {
“api_id”: “16daffbca6f3442e67b456dc452f9313”,
“api_name”: “Test API”,
“versions”: [“Default”]
}
},
“apply_policy_id”: “”,
“tags”: [],
“jwt_data”: {
“secret”: “”
},
“meta_data”: {},
“basic_auth_data”: {
“password”: “password”
}
}

Cheers,
Martin

On Thursday, January 7, 2016 at 11:26:26 AM UTC, Daniele Motta wrote:
Hi, anyone know how to create a key with custom username using Advanced Management API? The API auto-generate the username as part of the key_id, but i want set my custom username.
Any suggestions?


#4

Imported Google Group message.
Sender:Martin Buhr.
Date:Thursday, 7 January 2016 13:43:58 UTC.

Thanks for the accurate and quick reply.

Daniele

  • show quoted text -