authorizer icon indicating copy to clipboard operation
authorizer copied to clipboard

Custom script is not working

Open VladimirCores opened this issue 3 years ago • 12 comments

My custom script:

image

Issued JWT:

eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJmMGNkYmFjOS0xZDA5LTQ4MDQtOGY0Ni04MzViMzAxMjFjZDciLCJleHAiOjE2NjQ0MDM1MDcsImlhdCI6MTY2NDQwMTcwNywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgxIiwibG9naW5fbWV0aG9kIjoiYmFzaWNfYXV0aCIsIm5vbmNlIjoiM2JmNTNiOTEtZDk0OS00NzVhLTgzMGUtYmUwYmFlMzZhOTczIiwicm9sZXMiOlsidXNlciJdLCJzY29wZSI6WyJvcGVuaWQiLCJwcm9maWxlIiwiZW1haWwiXSwic3ViIjoiMTQzNmQxMTgtNDlhYS00ZjJhLThlNTItMTlmNzJjZjY1OWVlIiwidG9rZW5fdHlwZSI6ImFjY2Vzc190b2tlbiJ9.nCJ7qdnA7ZV_02Ea33_8MvvEqh4waAtUb6fP2C70D__g7dlZ0V_VJSvCKf5RhsQKo3a_G_RCzCCDfz7J3BtIGJpHDjdvFW_TO-IqSmyXa_kM9gjM2piT3hzyfR_kjadHShLtehXNxWi-3y0cYgRIZDvjj4MGiTbgvwvb8ezAaYLQL1kEatZ0jUa136ZV3FVqBO2O7kcEoySRvvedU-eAE5lmVC7Za9q24DkXhza57c1MFjlLmFZ44A5-Be7ZWr41eE6V0oOdYYoIqe0sT4GUDTDOUhwdGhJlqxBWdqxyuFsYVNcI04tp4AGS9WvqK3RCWUNAwOSBo6MgJ9syJ1_g9w

image

VladimirCores avatar Sep 28 '22 21:09 VladimirCores

@VladimirCores this access token. Custom scripts add data to ID token which you can use with your APIs and use access token with authorizer APIs.

lakhansamani avatar Sep 29 '22 00:09 lakhansamani

All right, its not clean that it will add something to ID token, thanks for clarifying! ;) Anyway, is there any way how to extend access_token with additional data?

VladimirCores avatar Sep 29 '22 05:09 VladimirCores

@VladimirCores thanks for the input. I will update the docs for this use case. Also we don't have the way to extend access_token. Any specific usecase where you would like to use access_token instead of id_token?

If required. I can quickly added same util to access token.

Thanks

lakhansamani avatar Sep 29 '22 06:09 lakhansamani

The use case is in accessing data from CouchDB with 3rd party JWT, it require additional property in access_token - "_couchdb.roles" or "sub" to be registered in allowed users for specific DB. Take a look here. image

VladimirCores avatar Sep 29 '22 06:09 VladimirCores

So in that case you should be using id_token, which is again jwt token with couchdb apis

lakhansamani avatar Sep 29 '22 10:09 lakhansamani

We use similar approach in Hasura: https://docs.authorizer.dev/integrations/hasura

lakhansamani avatar Sep 29 '22 10:09 lakhansamani

Ok, I'll try later and let you know, thanks ; )

VladimirCores avatar Sep 29 '22 10:09 VladimirCores

It works with id_token, however everytime I restart Docker image the method reset to default: image

VladimirCores avatar Oct 09 '22 09:10 VladimirCores

Which DB are you using?

lakhansamani avatar Oct 09 '22 09:10 lakhansamani

Default sqlite image

VladimirCores avatar Oct 09 '22 09:10 VladimirCores

Thanks I will try to reproduce and get back

lakhansamani avatar Oct 09 '22 09:10 lakhansamani

@VladimirCores not able to reproduce this issue.

lakhansamani avatar Feb 08 '23 04:02 lakhansamani