I'm trying to validate the URL param verificationToken
, the issue is that the reply is always Verification token is required.
as if the token is not provided in the URL.
export const UserActivationSchema = {
schema : {
querystring: {
type : 'object',
required : [ 'verificationToken' ],
additionalProperties: false,
properties : {
verificationToken: {
type: 'string'
},
},
errorMessage : {
properties: {
verificationToken: 'Verification token is required.'
},
required: 'Verification token is required.'
}
},
},
handler: activateEmail,
}
The route:
fastify.get( '/activate/:verificationToken', UserActivationSchema );
I need to verify the verificationToken
it is a string and provided in the URL.
Any idea how to fix this?
I'm trying to verify the verificationToken
is a string and provided in the URL.
The url in that syntax defines a path parameter and it is not a query string parameter.
You must change the schema property querystring
to params
.