Skip to content

Is it possible to generate new role with apikey ? #1925

Discussion options

You must be logged in to vote

Hey @danielstaleiny,

Yes, you can do this now but there is a gotcha - the Kong api gateway only accepts the anon key or the service_role key for reaching postgrest. For postgrest's authorization bearer, you can use any role.

So for the request, you'll need to specify the anonkey(this has a 10 year exp default) plus a custom key that includes your role and any expiration. You can build this custom key with https://jwt.io/ and your API secret(at <your_project>/settings/api).

Some steps that might help:

-- create your role
create role third_partier;
grant third_partier to authenticator;
grant usage on schema public to third_partier;
-- assign any extra privilege here

-- create a function fo…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@danielstaleiny
Comment options

Answer selected by steve-chavez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants