I try to include a verificaton link as plain text into an email which points on a GraphQL endpoint but browser/email client doesn't display it correctly.
It can't parse symbols like !,",{,} which I need for the link query and ultimately it becomes broken. Also, I've tried to include the link into href attribute of the a tag but the problem is, that it fails to parse double quotes also.
Link example:
https://blahblah.now.sh/graphql?query=query($email:String!,$token:String!){verifyEmailToken(email:$email,token:$token)}&variables={"email":"[email protected]","token": "221c4dfd976f3ac22f"}
Certain characters have special meaning in the context of a URL. You should use encodeURI to escape these characters. The resulting URL would be:
For additional details, see Why should I use urlencode? and Should I use encodeURI or encodeURIComponent for encoding URLs?