Is there a limit to the number of attributes you can set on an OAuth token in Apigee ?

Is there a limit to the number of attributes you can set on an OAuth token in Apigee ?

~~S:G:TC~~

Solved Solved
0 5 1,454
2 ACCEPTED SOLUTIONS

@Anil Sagar AFAIK there is no limit on the # of attributes you can include in your token.

View solution in original post

There is a limit to the custom attributes you can attach to an entity - like a Developer or Developer App. For example, see here. But I don't think that same limit applies to the token.

In any case if the limit is reached, it's a simple matter to simply coalesce multiple attributes into a single value - for example coalesce them into a JSON hash or a comma-separated string. And then you can store 5-10 values or more in a single attribute. So in practice you probably aren't going to need it.

Lastly, I'd say it might not be optimal to store everything in the token. Maybe there is a lookup that occurs based on the identity (maybe username) associated to the token, and that set of attributes associated to the username can be stored in Cache. That of course can be quite large - up to 512kb. Then, when a token is presented, you retrieve the username as a custom attribute on the token and then do a cache lookup using the username as the cache key.

Lots of ways to address the problem depending on data volumes, data linkages, and so on.

View solution in original post

5 REPLIES 5

@Anil Sagar AFAIK there is no limit on the # of attributes you can include in your token.

Thank you @sudheendra

There is a limit to the custom attributes you can attach to an entity - like a Developer or Developer App. For example, see here. But I don't think that same limit applies to the token.

In any case if the limit is reached, it's a simple matter to simply coalesce multiple attributes into a single value - for example coalesce them into a JSON hash or a comma-separated string. And then you can store 5-10 values or more in a single attribute. So in practice you probably aren't going to need it.

Lastly, I'd say it might not be optimal to store everything in the token. Maybe there is a lookup that occurs based on the identity (maybe username) associated to the token, and that set of attributes associated to the username can be stored in Cache. That of course can be quite large - up to 512kb. Then, when a token is presented, you retrieve the username as a custom attribute on the token and then do a cache lookup using the username as the cache key.

Lots of ways to address the problem depending on data volumes, data linkages, and so on.

Yes, I agree with you Dino! You need to be conscious before adding every attribute into your token. There are multiple options - cache, encrypted KVM to store custom attributes.

Great Answer, Thank you @Dino