验证iPhone推送通知令牌? [英] validate iphone push notification token?

查看:63
本文介绍了验证iPhone推送通知令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尚未在我的应用中实现推送通知.我的理解是,设备上运行的应用程序必须请求一个令牌,然后将该令牌发送到我的服务器,并且每当我想向设备/应用程序发送消息时,我的服务器就必须将该令牌传递给Apple.

I've not yet implemented push notifications in my app. My understanding is that the app running on the device must request a token, then send this token to my server, and that my server must pass this token to Apple whenever I want to push a message to the device / app.

请求的推送令牌是特定于应用程序的,还是设备上的所有应用程序都共享令牌?

我是否可以通过任何方法验证设备发送给我的服务器的令牌确实是由我的应用程序中的请求生成的?

我担心可能存在的恶作剧,即流氓应用程序可能向我的服务器发送不是我的应用程序请求的令牌的有效令牌.这会欺骗我的服务向该设备/应用发送推送通知.

I'm concerned about a possible spoof where a rogue app could send a valid token to my server that wasn't a token my app requested. This would trick my service into sending push notifications to that device/app.

我知道这是一个不太可能发生的情况.我正在尝试创建一种机制,以验证当我的应用程序向服务器发送信息时,我确实是在与我的应用程序实例通信,而不是某些流氓客户端.推送通知似乎是实现此目的的一种可能方法.

I understand this is an unlikely scenario. I'm trying to create a mechanism to verify that when my app sends information to my server I am indeed talking with an instance of my app, not some rogue client. Push notifications seem like a possible way to achieve this.

推荐答案

请求的推送令牌是特定于应用程序的,还是设备上的所有应用程序共享令牌?没有所请求的令牌是特定于您的应用程序和每个设备的.

Is a requested push token specific to the app, or do all apps on the device share a token? No the requested token is specific to your Application and each device.

我是否可以通过任何方法验证设备发送给我的服务器的令牌确实是由我的应用程序中的请求生成的?苹果提供了一项服务,您可以在其中查询并确定令牌是否仍然有效",该令牌用于诸如用户删除您的应用程序且其令牌无效的事情,您可以查询该服务并检查是否令牌仍然有效,如果不从您的数据库中删除它,那么您也可以使用此服务来确保给定的任何令牌都是有效的...无论如何,如果您尝试使用无效的令牌,我怀疑不会发生任何事情...

Is there any way for me to validate that the token the device sends to my server was indeed generated by a request within my app? There is a service with apple in which you can query and find out if a token is "still valid", this is used for things such as when a user deletes your application and their token is invalidated, you can query the service and check if the token is still valid and if not delete it from your database...So you can also use this service to make sure any tokens given are valid...anyway if u try to push to an invalid token i suspect nothing will happen...

希望这会有所帮助

这篇关于验证iPhone推送通知令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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