Skip to content

feat: seller api keys #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

feat: seller api keys #127

wants to merge 9 commits into from

Conversation

slusarczykmichal
Copy link
Collaborator

No description provided.

const {
data: [api_key]
} = await query.graph({
entity: 'seller_api_key',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why dont just use medusa secret api keys with created_by with seller auth context actor id?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medusa supports only one active secret key in the database at the time: https://github.com/medusajs/medusa/blob/develop/packages/modules/api-key/src/services/api-key-module-service.ts#L480

Their api-key implementation is clearly meant only for admin at the moment

) => {
const query = container.resolve(ContainerRegistrationKeys.QUERY)

await revokeSellerApiKeyWorkflow.run({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same goes here

const query = container.resolve(ContainerRegistrationKeys.QUERY)

const { data: api_keys, metadata } = await query.graph({
entity: 'seller_api_key',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same goes here

@@ -121,6 +129,22 @@ class SellerModuleService extends MedusaService({
})
}

public async generateSecretKey() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question goes why dont jsut use default medusa module?

let normalizedToken = token
if (!token.startsWith('ssk_')) {
normalizedToken = Buffer.from(token, 'base64').toString('utf-8')
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same goes here

return fetchSellerByAuthActorId(ctx.actor_id, scope, fields)
}

if (ctx.actor_type === 'seller-api-key') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same goes here

@slusarczykmichal slusarczykmichal marked this pull request as draft May 23, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants