从Email Angular 6检索令牌 [英] Retrieving token from Email Angular 6

查看:66
本文介绍了从Email Angular 6检索令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户注册时,API会通过令牌向他们发送一封电子邮件,以验证用户身份.API的端点需要令牌来验证用户,如何获取令牌并将其发布到API

When a user register an email is sent to them from the API with a token to verify the user. an endpoint of the API requires the token to verify the user, how do I get the token and post it to the API

推荐答案

在您的注册邮件中包含一个可点击的url,其中包括令牌作为查询参数.例如 https://website.com/confirmRegistration?token=insertTokenHere

Include a clickable url in your registrationmail which includes the token as query parameter. e.g. https://website.com/confirmRegistration?token=insertTokenHere

然后为/confirmRegistration创建组件和路由,将 ActivatedRoute 注入该组件,并使用 this.route.snapshot.queryParamMap.get('token'); .使用值调用API端点.

then create a component and a route for /confirmRegistration, inject ActivatedRoute into that component and read the token with this.route.snapshot.queryParamMap.get('token');. use the Value to call the API endpoint.

这篇关于从Email Angular 6检索令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆