Apigee import consumer Key with expiry time

Is there a way to import a consumer Key with a set expiry time?

I am able to import the keys through the apigee migrate tool/management APIs. However, the imported keys have the expiry set to "Never Expires" and unfortunately Apigee Edge does not allow editing the expiry time once the keys are created.

https://docs.apigee.com/api-platform/publish/import-existing-consumer-keys-and-secrets - The documentation has no mention of setting expiry time while importing the keys.

I did see the reference to an earlier post on migrating the API keys, but there is no mention of setting the expiry time there.  - https://www.googlecloudcommunity.com/gc/Cloud-Product-Articles/Need-to-migrate-a-ConsumerKey-from-on...

@DChiesa any pointers on how to get around this?

Solved Solved
0 4 303
1 ACCEPTED SOLUTION

There is no workaround in Apigee Edge.  If you import a credential, the expiry of that imported credential is always "never".

The capability to import a credential (key) with an explicit expiry exists in Apigee  hybrid and Apigee X. The administrative API call looks like this: 

POST :mgmtserver/v1/organizations/:org/developers/:developerId/apps/:app/keys/create
Authorization: Bearer :token
Content-type: application/json

{
 "consumerKey": ":newkey",
 "consumerSecret": ":newsecret",
 "expiresInSeconds": "3600"
}

This is not (yet?) enabled in the UI. And I don't know of an existing feature enhancement request to allow that in the UI. But it works in the API.

View solution in original post

4 REPLIES 4

There is no workaround in Apigee Edge.  If you import a credential, the expiry of that imported credential is always "never".

The capability to import a credential (key) with an explicit expiry exists in Apigee  hybrid and Apigee X. The administrative API call looks like this: 

POST :mgmtserver/v1/organizations/:org/developers/:developerId/apps/:app/keys/create
Authorization: Bearer :token
Content-type: application/json

{
 "consumerKey": ":newkey",
 "consumerSecret": ":newsecret",
 "expiresInSeconds": "3600"
}

This is not (yet?) enabled in the UI. And I don't know of an existing feature enhancement request to allow that in the UI. But it works in the API.

Thanks @dchiesa1 . Any chance of making this administrative API you mentioned above available for OPDK (4.50)?

I am not the product manager who oversees such decisions, but.... I think the likelihood that this API will be made available in OPDK is relatively low.  There is an outstanding request to make this happen, but PM has not yet agreed to include this change into an OPDK release. BTW, The ticket number is b/114303252. 

Thanks for the information on the pending request.