#Is there a way to create a customer account without an email (with a custom auth provider)?

34 messages · Page 1 of 1 (latest)

rare flint
#

I wonder if anyone tried or knows a way to implement a custom auth provider that doesnt use emails.
How should this auth flow create a customer since right now the email field is required.

I am implementing a auth flow with SIWE (sign-in with ethereum), so a wallet based authentication, but in this case I dont have a email available and best case it would only be optional for a user.

solar hemlock
#

@rare flint yes we have done it through mobile OTP and passkey in V2. Also for V1 we have implemented google sign in and discord and I am pretty sure that we can do that for V2 too. Lets connect via DM

rare flint
#

@solar hemlock I message you

raven wedge
#

@solar hemlock @rare flint Hi,would you pls help me? I am also try to do this. thank you!

strong ridge
#

Yes, we have also done through mobile OTP using custom auth provider module.

raven wedge
#

@strong ridge any resoure to learn how to do? thank you

strong ridge
raven wedge
#

Thank you so much @strong ridge , i will try it.

frail nexus
#

@strong ridge care to share that utils/common

gentle sparrow
strong ridge
#

I am using local sms provider to send OTP, that comes like api and i was calling that api using axios

#

that portion will be open, you can use some other provider also to send message like twilio etc,

upper creek
#

hey i am signing in user with only using mobile number and i don;t have any email and password. I'm having trouble in generating token can you help me with how we can generate token

gentle sparrow
strong ridge
#

module.exports.sendSMS = async(phoneNumber,message,lang="ar") => {

const SMS_API_URL = 'https://messaging.ooredoo.qa/bms/soap/Messenger.asmx/HTTP_SendSms';
const params = {
    customerID:"***",
    userName:"***",
    userPassword:"***",
    originator:"***",
    smsText:"Your OTP is 8484",
    recipientPhone:phoneNumber,
    defDate:"",
    blink:"false",
    flash:"false",
    Private:"false",
}
const queryString = new URLSearchParams(params).toString();
try {
 await axios.get(`${SMS_API_URL}?${queryString}`)  
} catch (error) {
    console.error('Error sending SMS:', error.message);
}

}

I have written one common function
and I called this my sendotp workflow

#

this is my approach, because I used sendsms function lot of spaces

if you use only for otp

you can create a workflowstep function and put above function code and the call the step inside your workflow

#

@gentle sparrow

upper creek
strong ridge
strong ridge
upper creek
#

oh okk np 👍

upper creek
# strong ridge I shared the changes in this zip file, can you please check that

hey if u have some time can u look at this code https://github.com/awaiskhan21/medusa/blob/master/src/modules/my-auth/service.ts
If i am using the token from this req http://localhost:9000/auth/user/my-auth i am not able to visit admin routes it is giving unauthorize ,thanks

GitHub

Contribute to awaiskhan21/medusa development by creating an account on GitHub.

upper creek
#

hey if possible can you share your service.ts of custom auth

strong ridge
#

import { MedusaService } from "@medusajs/framework/utils"
import { MobileOtp } from "./models/mobile-otp"

class MobileOtpModuleService extends MedusaService({
MobileOtp,
}) {

}

export default MobileOtpModuleService

this is my service.ts file

upper creek
upper creek
#

thanks @strong ridge i am able to implement it

gentle sparrow
#

@strong ridge
export const sendOtpStep = createStep(
"send-otp-step",
async (input: sendOtpStepInput, { container }) => {
// will process the sms send flow here
return new StepResponse()
}
)

so I need to add sms service here?

sullen vigil
#

hii Guys, anyone know about razorpay plugin
i am using https://medusajs.com/plugins/@sgftechpayment-razorpay/
but getting error
Received response with status 500

⨯ Error: Error setting up the request: An unknown error occurred.
at medusaError (D:\medusa\my-medusa-storefront.next\server\chunks\ssr[root of the server]__fe5969._.js:58:15)
digest: "1214483063"
POST /dk/checkout?step=payment 500 in 183ms
Initiating Medusa client with default headers:
{
"accept": "application/json",
"content-type": "application/json",
"x-publishable-api-key": "pk_713b98abd67c60b752dac50a3b4b112632399a785b12f2e5a3c69eb4ae19a74e",
"authorization": "<REDACTED>"
}

Medusa

The most popular ecommerce project on GitHub. Medusa provides the world's most flexible digital commerce platform.

surreal plank
#

Hi @upper creek @strong ridge , is there any way to login customer using just phone number and password. and use the otp only during the registration and connect them with the customer?

surreal plank
#

I have done it. If anyone wants drop me a message.

strong ridge
#

Super

gentle sparrow