@@ -2,7 +2,7 @@ import { HttpException, Injectable } from '@nestjs/common';
22import fetch from 'node-fetch' ;
33import * as Sentry from '@sentry/node' ;
44import Config from '../../../config' ;
5- import type { Auth0Response } from './auth0.types' ;
5+ import type { Auth0Response , EmailVerificationTicket } from './auth0.types' ;
66
77@Injectable ( )
88export class Auth0Service {
@@ -62,28 +62,30 @@ export class Auth0Service {
6262 return response ;
6363 }
6464
65- async sendVerificationEmail (
65+ async createVerificationEmailTicket (
6666 accessToken : string ,
6767 auth0UserId : string ,
6868 ) : Promise < Auth0Response > {
6969 try {
7070 const [ provider , userId ] = auth0UserId . split ( '|' ) ;
7171 const payload = {
72+ result_url : Config . urls . CLIENT_BASE_URL ,
7273 user_id : auth0UserId ,
7374 identity : { user_id : userId , provider } ,
7475 } ;
76+
7577 const options = {
7678 method : 'POST' ,
7779 headers : {
78- Authorization : `Bearer ${ accessToken } ` ,
80+ ' Authorization' : `Bearer ${ accessToken } ` ,
7981 'content-type' : 'application/json' ,
8082 } ,
8183 body : JSON . stringify ( payload ) ,
8284 } ;
8385
84- const response : Auth0Response = await (
86+ const response : Auth0Response < EmailVerificationTicket > = await (
8587 await fetch (
86- `https://${ Config . auth0 . backend . DOMAIN } /api/v2/jobs/verification- email` ,
88+ `https://${ Config . auth0 . backend . DOMAIN } /api/v2/tickets/ email-verification ` ,
8789 options ,
8890 )
8991 ) . json ( ) ;
0 commit comments