Apple发布了一种新的方法来对服务器到服务器的CloudKit进行身份验证.https://developer.apple.com/library/content/documentation/DataManagement/Conceptual/CloudKitWebServicesReference/SettingUpWebServices.html#//apple_ref/doc/uid/TP40015240-CH24-SW6
我尝试对CloudKit和此方法进行身份验证.起初我生成了密钥对并将公钥提供给CloudKit,到目前为止没问题.
我开始构建请求标头.根据文档,它应该如下所示:
X-Apple-CloudKit-Request-KeyID: [keyID]
X-Apple-CloudKit-Request-ISO8601Date: [date]
X-Apple-CloudKit-Request-SignatureV1: [signature]
Run Code Online (Sandbox Code Playgroud)
文件说:
在步骤1中创建的签名.
第1步说:
连接以下参数并用冒号分隔它们.
[Current date]:[Request body]:[Web Service URL]
我问自己"为什么我必须生成密钥对?".
但第2步说:
使用您的私钥计算此消息的ECDSA签名.
也许他们的意思是用私钥签名连接签名并将其放入标题?无论如何我试过两个......
我对此(无符号)签名值的示例如下所示:
2016-02-06T20:41:00Z:YTdkNzAwYTllNjI1M2EyZTllNDNiZjVmYjg0MWFhMGRiMTE2MjI1NTYwNTA2YzQyODc4MjUwNTQ0YTE5YTg4Yw==:https://api.apple-cloudkit.com/database/1/[iCloud Container]/development/public/records/lookup
Run Code Online (Sandbox Code Playgroud)
请求体值是SHA256哈希值,然后是base64编码的.我的问题是,我应该用":"连接,但是网址和日期也包含":".这是对的吗?(我还尝试对URL进行URL编码并删除日期中的":").
接下来,我用ECDSA签署了这个签名字符串,将其放入标题并发送.但我总是得到401"身份验证失败".为了签名,我使用ecdsa python模块,使用以下命令:
from ecdsa import SigningKey
a = SigningKey.from_pem(open("path_to_pem_file").read())
b = "[date]:[base64(request_body)]:/database/1/iCloud....."
print a.sign(b).encode('hex')
Run Code Online (Sandbox Code Playgroud)
也许python模块无法正常工作.但它可以从私钥生成正确的公钥.所以我希望其他功能也能奏效.
有没有人设法使用服务器到服务器方法对CloudKit进行身份验证?它是如何正常工作的?
编辑:正确的python版本工作
from ecdsa import SigningKey
import ecdsa, base64, hashlib
a = SigningKey.from_pem(open("path_to_pem_file").read())
b = "[date]:[base64(sha256(request_body))]:/database/1/iCloud....."
signature = a.sign(b, hashfunc=hashlib.sha256, sigencode=ecdsa.util.sigencode_der)
signature = base64.b64encode(signature)
print signature #include this into the header
Run Code Online (Sandbox Code Playgroud) 我已成功为 Google Play 实施订阅验证,但我很难理解 iOS 自动续订订阅的验证流程,想寻求您的帮助。以下是 Google Play 的高级逻辑:
notifications server-to-server ios firebase in-app-subscription
我按照https://developers.google.com/bigquery/authorization#service-accounts-appengine中的说明 从app引擎到bigquery进行了一些查询.
在第2步中,我点击Google Api控制台中的团队,然后重定向到App Engine>管理>权限.我将服务帐户名称添加为电子邮件,并选择我选择开发人员的角色("可以编辑"选项不可用),然后单击"邀请用户".之后,会显示一条消息:"已将电子邮件发送至xxxxxx@appspot.gserviceaccount.com进行验证." 状态为待定.我如何确认电子邮件?,似乎这里有一个错误...
接下来,我使用以下代码进行了测试:
#!/usr/bin/env python
import httplib2
import webapp2
from google.appengine.api import memcache
from apiclient.discovery import build
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from oauth2client.appengine import AppAssertionCredentials
# BigQuery API Settings
PROJECT_NUMBER = 'XXXXXXXX'
credentials = AppAssertionCredentials(scope='https://www.googleapis.com/auth/bigquery')
http = credentials.authorize(httplib2.Http(memcache))
service = build("bigquery", "v2", http=http)
class MainHandler(webapp2.RequestHandler):
def get(self):
query = {'query':'SELECT word,count(word) AS count FROM publicdata:samples.shakespeare GROUP BY word;',
'timeoutMs':10000}
jobRunner = service.jobs()
reply = jobRunner.query(projectId=PROJECT_NUMBER,body=query).execute()
self.response.out.write(reply)
app = webapp2.WSGIApplication([
('/', …Run Code Online (Sandbox Code Playgroud) google-app-engine authorization server-to-server google-bigquery
我正在尝试使用socket.io通过ssl连接设置服务器到服务器链接.这是我的例子:
/**
* Server
*/
var app = require('express')();
var config = require('./config');
var https = require('https');
var http = require('http');
var fs = require('fs');
var server = https.createServer({key: fs.readFileSync(config.ssl.key), cert: fs.readFileSync(config.ssl.cert), passphrase: config.ssl.passphrase}, app);
//var server = http.createServer(app);
var io = require('socket.io').listen(server);
server.listen(config.port);
app.get('/', function (req, res) {
res.send('Server');
//res.sendfile(__dirname + '/index.html');
});
io.sockets.on('connection', function (socket) {
socket.emit('news', { hello: 'world' });
socket.on('my other event', function (data) {
console.log(data);
});
});
/**
* Client
*/
var io = require('socket.io-client'); …Run Code Online (Sandbox Code Playgroud) 我需要实现服务器端逻辑,以处理苹果 iOS 订阅状态的变化https://developer.apple.com/documentation/storekit/in-app_purchase/enabling_status_update_notifications
我的问题是:
我可以用 Firebase 做到这一点吗?即我可以在firebase服务器上放置一些例如“node.js”代码来处理来自苹果服务器的消息吗?
当我使用 测试 firebase db 服务器时nscurl --ats-diagnostics https://server.com,检查它是否与苹果 ATS(https://developer.apple.com/documentation/security/preventing_insecure_network_connections)兼容,它仅在 TLSv1.3 时失败,是否足以满足苹果 ats 的要求?
编辑 26/11/2020 - 顺便说一句,我使用 Firebase 云功能成功实现了 iOS 订阅 - 所以 Firebase 是一条路。
我没有得到unified_receipt应用程序购买收据中苹果沙盒中的开发人员文档中所述的信息。
根据他们的文档:https ://developer.apple.com/documentation/appstoreservernotifications/responsebody
重要的
以下顶级对象计划弃用:latest_receipt、latest_receipt_info、latest_expired_receipt 和latest_expired_receipt_info。更新任何现有代码以依赖 Unified_receipt 中的以下对象:latest_receipt 和latest_receipt_info。
但在我的回应中,我没有得到unified_receipt。
我需要帮助才能正确决定如何使用谷歌API.
我想开发一个脚本来连接服务器到服务器(没有任何Oauth2连接)到我的谷歌驱动器文件夹,以便在网页中显示谷歌驱动器文件和文件夹.如果某些文件更新,我还会设置一个cron作业来执行操作.
这可能吗?在谷歌云平台中,我发现驱动器api具有服务器到服务器的交互.这是正确的解决方案吗?
谢谢!
这只是关于微服务架构的一般问题。如果外部世界无法访问它们,为什么 2 个或更多内部服务仍然需要像 oauth2 这样的令牌身份验证来相互通信?他们的 api 不能只是过滤内部 IP 地址吗?这种方法有什么风险?
authentication server-to-server docker kubernetes microservices
我正在尝试调用 api Purchases.products: get来验证您的购买,它会产生这样的结果
{
"error": {
"errors": [
{
"domain": "androidpublisher",
"reason": "permissionDenied",
"message": "The current user has insufficient permissions to perform the requested operation."
}
],
"code": 401,
"message": "The current user has insufficient permissions to perform the requested operation."
}
}
Run Code Online (Sandbox Code Playgroud)
这里的文档说明了你可以做什么
收到的令牌不仅仅适用于任何其他 api 的购买检查,它返回结果(Inappproducts: list is work)
验证 url 构建正确,因为如果您将令牌客户端连接到服务器,那么此 api 也可以工作 - 但我需要一个服务器来进行服务器身份验证
scopes = ['https://www.googleapis.com/auth/androidpublisher']
authorization = Google::Auth.get_application_default(scopes)
uri = "https://www.googleapis.com/androidpublisher/v3/applications/#{ENV['ANDROID_PACKAGE_NAME']}/purchases/products/#{purchasable.purchase_uuid}/tokens/#{purchase_token}?access_token=#{authorization.fetch_access_token!['access_token']}" …Run Code Online (Sandbox Code Playgroud) authentication server-to-server google-oauth android-inapp-purchase
ios ×3
firebase ×2
cloudkit ×1
docker ×1
google-oauth ×1
kubernetes ×1
node.js ×1
php ×1
socket.io ×1
ssl ×1
subscription ×1