ios - Apple Passkit 的 webServiceURL 的 URL 应该是什么
问题描述
我正在为 Apple Passkit 创建凭据。
Apple 提供的示例是用 Ruby 编写的(我不熟悉),它使用端点 /v1/devices/deviceID/registrations/typeID/serial
我在“/v1/devices/:device_id/registrations/:pass_type_id/:serial_number”处用快递写了一个端点
我应该为 Apple Passkit 中的 webServiceURL 使用什么 URL,以便它连接到节点端点。
我使用“webServiceURL”:“https://myapp.com/v1/devices”,
NodeJS 函数是
app.post('/v1/devices/:device_id/registrations/:pass_type_id/:serial_number', async (req, res, next)=>{
这是提供的苹果代码
post '/v1/devices/:device_id/registrations/:pass_type_id/:serial_number' do
puts "Handling registration request..."
# validate that the request is authorized to deal with the pass referenced
puts "#<RegistrationRequest device_id: #{params[:device_id]}, pass_type_id: #{params[:pass_type_id]}, serial_number: #{params[:serial_number]}, authentication_token: #{authentication_token}, push_token: #{push_token}>"
if @passes.where(:serial_number => params[:serial_number]).where(:authentication_token => authentication_token).first
puts 'Pass and authentication token match.'
# Validate that the device has not previously registered
# Note: this is done with a composite key that is combination of the device_id and the pass serial_number
uuid = params[:device_id] + "-" + params[:serial_number]
if @registrations.where(:uuid => uuid).count < 1
# No registration found, lets add the device
@registrations.insert(:uuid => uuid, :device_id => params[:device_id], :pass_type_id => params[:pass_type_id], :push_token => push_token, :serial_number => params[:serial_number])
# Return a 201 CREATED status
status 201
else
# The device has already registered for updates on this pass
# Acknowledge the request with a 200 OK response
status 200
end
else
# The device did not statisfy the authentication requirements
# Return a 401 NOT AUTHORIZED response
status 401
end
end
解决方案
推荐阅读
- android - 带有 ChildFragmentManager 的 Fragment 内部的底部 NavigationView 创建重叠视图
- r - 根据 R 中的标准消除重复值
- postgresql - Postgres 存储函数输入检查开销,解释计时结果
- mysql - 可以将所有相关列放在单个表中吗?多表的选择查询会影响性能吗?
- python - 我是一个“if/else”语句,我可以让用户输入的变量等于不同的东西吗?
- c++ - 在 C++ 中按引用调用或按值调用
- css - 使用其他类属性的新类
- python - Python 初学者 - 多项选择测验程序遇到问题
- c# - 发生“System.Threading.Tasks.TaskCanceledException”类型的异常,但未在用户代码中处理
- ios - 从 Firebase 检索 notificationTypes 的问题