Hello everyone, When creating an access key, how c...
# ask-a-descoper
i
Hello everyone, When creating an access key, how can I enforce that it is created only with a specific role?
r
Hi @Ido Gold When creating an access key, you can specify roles directly through the roleNames parameter if no tenants exist, or assign roles on a per-tenant basis using the keyTenants parameter. Check this https://docs.descope.com/management/m2m-access-keys/sdks#create-access-key
i
But is there a way to enforce that for a given tenant, they can only create access keys with a specific role? For example: I have tenant 1 with roles: Admin, Viewer, Writer. I want to limit users to generating access keys only with the Viewer role. From my understanding a user can use the "https://descope.backline.ai/v1/mgmt/accesskey/create" API and choose any role that he wants?
r
You mean you want to assign that tenant (roles: Admin, Viewer, Writer) to access key but after assign you only want them to give access Viewer role.
i
Correct
We currently allow users to create access keys using a Widget
r
Let me check this case
šŸ™ 1
@Ido Gold this kind of feature is not available yet in Descope can you create New Feature Request ? and put your requirement thier?
i
Thanks for the answers. A few more clarification questions, if possible: • Who has permissions to create access keys using the "https://descope.backline.ai/v1/mgmt/accesskey/create" API? • Can we limit it somehow so that only we (the admins) can call it and then call it from our own backend API? • Can we configure the widget to use our own API instead of the descope one?
r
Let me check @Ido Gold
šŸ™ 1
Hey @Ido Gold The Create Access Key API (https://descope.backline.ai/v1/mgmt/accesskey/create) requires a Management Key for authorization. The API endpoint uses Bearer authentication with the format
<Project ID>:<Management Key>
. Management Keys are administrative credentials that provide access to Descope's management APIs. Anyone with a valid Management Key can call this API endpoint. To limit access so only your admins can create access keys: 1. Secure your Management Key - Only share the Management Key with authorized administrators and store it securely in your backend environment 2. Call from your backend - Use the Management Key from your backend API rather than exposing it to frontend clients
Descope widgets cannot be configured to use your own API instead of the Descope API, as they are designed to work directly with Descope's backend services. However, you can build your own custom components that integrate with your backend APIs, and from there, leverage Descope APIs to achieve the required functionality.
i
Thanks @Rahul Rijhwani. So when creating an access token via the widget, what management key is passed to the API?
Bump