-
Notifications
You must be signed in to change notification settings - Fork 78
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
base: main
Are you sure you want to change the base?
Conversation
const { | ||
data: [api_key] | ||
} = await query.graph({ | ||
entity: 'seller_api_key', |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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({ |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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') | ||
} |
There was a problem hiding this comment.
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') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same goes here
17184a4
to
ff26da8
Compare
No description provided.