How do I pass complex JSON objects to the custom claims? Could you share some sample?
Laxman Venkatesan wrote:
Hi Laxman, you can't. The custom claims need to be in name/value pair format. One workaround could be serializing the complex object into JSON or base64, and add it as a custom claim.
Will the component be updated to support nested object in custom claim? Firebase accepts custom claims only as keys/values in 'claims' object claim.
https://firebase.google.com/docs/auth/admin/create-custom-tokens?hl=en#create_custom_tokens_using_a_third-party_jwt_library
Radoslaw Grabowski wrote:
Not in the roadmap for now, but if needed the workaround I mentioned above can be used.
João Almeida wrote:
I tried. How is it supposed to work if firebase requires nested object in the 'claims' claim and not the JSON string I can provide? I don't think it could work with some form of trying to escape the string but maybe I could have missed something.
I tried to provide custom claim without nesting in 'claims' claim but Firebase just ignores it.
I tried to provide JSON with my custom claims(as you suggested to do) as the value for 'claims' claim but then Firebase rejects the request.
In that case I'm afraid there's no workaround, right now the component only supports the claims as a list of name value pairs.
Hi,
I have created a component which can be used to generate JWT from a complex object types instead of key value pair. Hope this helps!
ComplexJWT
I could not get your solution to work
I modified the JWT component to be able to perform this. I am still waiting for approval to the merge request, until then, you can ping me for the modified version of JWT component ;)
Hi all. Regarding Laxman Venkatesan's problem, the best and fastest might be to work with Borislav Shumarov for his modified version. This is because we weren't any new features for version 4.0 (the last release was just and update of external libraries), the custom claims would go along with major features for 5.0, but that won't likely happen in the very near future.
Could you please to sharing the workaround solution, I have same issue. Thank you.
Hi Chanyut,
I have uploaded a Fork of the project on the Forge:
https://www.outsystems.com/forge/component-overview/16132/jwt-advanced
Let me know, if you have any problems