anurag06557
02/14/2024, 1:22 PMrp_st
02/14/2024, 1:59 PMrp_st
02/14/2024, 1:59 PManurag06557
02/21/2024, 8:09 AMasync function sendMagicLink() {
setIsDisableButton(true);
const responsePayload =
tab === DECCAN_MOBILE_TAB
? { phoneNumber: `+91${formData.phone}` }
: { email: formData.email };
const errMsg =
tab === DECCAN_MOBILE_TAB ? "Invalid phone number" : "Invalid email";
const infoMsg = tab === DECCAN_MOBILE_TAB ? INFO_MSG_PHONE : INFO_MSG_EMAIL;
const userContext = {
redirectUrl:callbackUrl
}
if (formData.phone || formData.email) {
try {
let response = await createPasswordlessCode(responsePayload,{callbackUrl});
now i want this callbackUrl thing in emailDelivery section where i need to append this callbackUrl as queryParam in the magic Link, how can i do this , i am trying to overRide emailDelivery function in the backend.
ThirdPartyPasswordless.init({
emailDelivery: {
service: new SMTPService({
smtpSettings,
override: (originalImplementation) => {
return {
...originalImplementation,
getContent: async function (input) {
const userContext = getRequestFromUserContext(input.userContext)
const magicLinkUrl = input.urlWithLinkCode + userContext["callbackUrl"]
const originalContent = await originalImplementation.getContent(
input,
);
please suggest as i am not getting the value at backendrp_st
02/21/2024, 8:10 AMgetRequestFromUserContext
anurag06557
02/21/2024, 9:02 AManurag06557
02/21/2024, 9:16 AManurag06557
02/21/2024, 9:17 AMuserContext: ExpressRequest {
wrapperUsed: true,
getFormData: [AsyncFunction (anonymous)],
getKeyValueFromQuery: [Function (anonymous)],
getJSONBody: [AsyncFunction (anonymous)],
getMethod: [Function (anonymous)],
getCookieValue: [Function (anonymous)],
getHeaderValue: [Function (anonymous)],
getOriginalURL: [Function (anonymous)],
original: IncomingMessage {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
socket: [Socket],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
rawHeaders: [Array],
rawTrailers: [],
joinDuplicateHeaders: null,
aborted: false,
upgrade: false,
url: '/auth/signinup/code',
method: 'POST',
statusCode: null,
statusMessage: null,
client: [Socket],
_consuming: true,
_dumped: false,
next: [Function: next],
baseUrl: '',
originalUrl: '/auth/signinup/code',
_parsedUrl: [Url],
params: {},
query: {},
res: [ServerResponse],
body: [Object],
[Symbol(kCapture)]: false,
[Symbol(kHeaders)]: [Object],
[Symbol(kHeadersCount)]: 40,
[Symbol(kTrailers)]: null,
[Symbol(kTrailersCount)]: 0
},
parserChecked: true,
formDataParserChecked: false
}
}
rp_st
02/21/2024, 9:17 AMrp_st
02/21/2024, 9:17 AMrp_st
02/21/2024, 9:17 AManurag06557
02/21/2024, 9:31 AMconst callbackUrl = userContext.getHeaderValue("callbackUrl")
anurag06557
02/21/2024, 9:31 AMrp_st
02/21/2024, 9:32 AManurag06557
02/21/2024, 9:33 AMrp_st
02/21/2024, 9:34 AMrp_st
02/21/2024, 9:34 AMrp_st
02/21/2024, 9:34 AManurag06557
02/22/2024, 11:56 AMrp_st
02/22/2024, 4:55 PMSuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).
Powered by