Skip to content

Commit 9f376ff

Browse files
authored
fix(js-sdk): allow passing custom request body parameters in auth.register method (medusajs#12545)
The `auth.login` method of the JS SDK allows passing custom, which is useful for custom authentication providers. For example: ```ts const response = await sdk.auth.login("customer", "phone-auth", { phone }) ``` However, the `auth.register` method doesn't allow that, so we can't do the following: ```ts const response = await sdk.auth.register("customer", "phone-auth", { phone }) ``` Instead, we'd have to use the `client.fetch` method. This PR fixes the input type of the payload passed to the `register` method to be similar to that of `login`, which would allow using it with custom authentication providers
1 parent d9fdabe commit 9f376ff

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/beige-carrots-care.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@medusajs/js-sdk": patch
3+
---
4+
5+
fix(js-sdk): allow passing custom request body parameters in auth.register method

packages/core/js-sdk/src/auth/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class Auth {
4848
register = async (
4949
actor: string,
5050
method: string,
51-
payload: HttpTypes.AdminSignUpWithEmailPassword
51+
payload: HttpTypes.AdminSignUpWithEmailPassword | Record<string, unknown>
5252
) => {
5353
const { token } = await this.client.fetch<{ token: string }>(
5454
`/auth/${actor}/${method}/register`,

0 commit comments

Comments
 (0)