define expiration date on a consumer key

Not applicable

is there any way to set expiration date on a key?

alternatively, when I call delete a key api - is it deleted automatically? is there any way to choose number of days for complete deletion of the key?

Thanks, Michael

Solved Solved
2 11 2,418
1 ACCEPTED SOLUTION

Not applicable

Michael,

The expiration property ("expiresAt") can only be set when creating the app. The following URL provides details on how the value can be set:

http://apigee.com/docs/management/apis/post/organizations/%7Borg_name%7D/developers/%7Bdeveloper_ema...

As of October 2016, you can specify the expiry in the Edge Administrative UI, at the time you create the key (aka credential).

3706-edge-set-expiry.gif

And yes, the API key gets deleted automatically and immediately when a DELETE call is made to the key api documented at : http://apigee.com/docs/management/apis/delete/organizations/%7Borg_name%7D/developers/%7Bdeveloper_e...

Arun

View solution in original post

11 REPLIES 11

Not applicable

Michael,

The expiration property ("expiresAt") can only be set when creating the app. The following URL provides details on how the value can be set:

http://apigee.com/docs/management/apis/post/organizations/%7Borg_name%7D/developers/%7Bdeveloper_ema...

As of October 2016, you can specify the expiry in the Edge Administrative UI, at the time you create the key (aka credential).

3706-edge-set-expiry.gif

And yes, the API key gets deleted automatically and immediately when a DELETE call is made to the key api documented at : http://apigee.com/docs/management/apis/delete/organizations/%7Borg_name%7D/developers/%7Bdeveloper_e...

Arun

thanks Arun,

Does the "expiresAt" property works on all of the app keys? Isn't there any way to set expiryAt date on some key and other expiry on other key?

Can I use this property on update app as well?

yes, via the API, you can create a developer app, with a key pair, with a particular expiration. Therefore it is no problem to create multiple developer apps with distinct keys, and distinct expirations.

@Arun Kumar:

I tried the creation of App with predefined expiry time and its working fine, but what about the developer apps created through Edge UI or App registered through Developer portal?

How can we update the expiry time for existing apps?

I tried following APIs but could not update the expiry time :

update an app attribute

Update developer app

Please suggest with some example.

Thanks.

Not applicable

The keyExpriesIn element in Developer App Payload will set the expiration time for the consumer Key (see here). However, that can only be set when the key is created. You cannot set it for any existing keys.

Also - in the Edge Administrative UI, you can now generate keys and specify the expiry.

See here for details.

Not applicable

Is there a way when the expiry of a key happens, another ap or script gets called to do other cleanup tasks on our platform (ex. removal of user accounts, data, etc.)?

,

Is there a way when the expiry date/time happens, it also calls another ap or script that does clean up or deletion work of user accounts and data on our platform?

@mike yang

The answer is No. There can be couple of work arounds. It won't be exactly what you are looking for but might come close:

1. Through policies. Policies won't detect when a key is getting expired. But when the first failed call happens due to key expiry, then you can trigger scripts to do other stuff. So what I mean is:

Call 1... Call 50 all were successful, and nothing happens. Lets say call 51 fails due to key expiry. Now you can create a conditional policy that when the key expires, it will trigger off some scripts. Now the catch is Call 51 can either never come in or Call 51 can be n number of hours after the expiry of the key.

2. You can export the configurations via APIs and manage this logic outside Apigee.

Let me know if this makes sense.

On a different note, this should be a different question. If you need further clarifications, please open it up as a new question.

Thanks @sarthak , Created a new question here. @mike yang , Please continue discussion here.

@sarthak

Makes sense! But is there a way to make a default expiry date based on the create date of a default app when a user registers?

Thanks for your help!

Not applicable

If you would like to create a credential with a specific expiration time to an app you have to send a PUT request to the apps endpoint with the following payload.

https://docs.apigee.com/management/apis/post/organizations/%7Borg_name%7D/developers/%7Bdeveloper_em...

{"apiProducts":["product1", "product2"],"keyExpiresIn":636528782}

As far as I can see with the approach there is no way to set the credential key or secret.