Skip to content

Conversation

@rigbyms
Copy link
Collaborator

@rigbyms rigbyms commented Mar 20, 2025

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

})
}

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

@rigbyms rigbyms 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.

3 participants