繁体   English   中英

将使用 Apple 登录和 Firebase 的 iOS 应用程序转移到新的开发者帐户

[英]Transfer iOS app that uses Apple Sign in and Firebase to a new developer account

作为应用程序收购的一部分,我们正在将应用程序从一个 Apple 开发者帐户转移到另一个帐户。 该应用程序使用 Apple Sign in 和 Firebase 身份验证,似乎需要完成一些步骤来为使用 Apple Sign in 注册的用户生成传输标识符。这在此处记录:

https://developer.apple.com/documentation/sign_in_with_apple/transferring_your_apps_and_users_to_another_team

但是,因为我们使用 Firebase 作为我们应用程序的后端,我们无法直接控制身份验证过程和 Apple 登录生成的用户 ID,以及它们如何存储在 Firebase Auth 中,以及如何在应用程序传输后更新它们。

关于如何生成转移标识符的文档也很混乱,因为不清楚是否需要为所有用户生成转移标识符以及如果用户在他们提到的 60 天内未登录应用程序该怎么办转移后。

如果有人在此之前遇到过这种情况,我们将非常感谢您就如何实现这一点提供一些建议。 非常感谢!!

我不完全理解你关于 firebase 令牌的问题。

在我的系统中,我将每个设备的用户标识符和 firebase 令牌都存储到数据库中。 像下面这样的东西......

[id], [userid], [appleUserId], [firebaseToken]
0001, xxxxx, 000625.9cc9a4be8d0c4axxxxxxxxxxxxxxxxxx.xxxx, c9ujMuHrc0f3keNzd1x1ae:APA91bHp......
0002, yyyyy, 001429.9ca6469bfab94xyyyyyyyyyyyyyyyyyy.yyyy, eUiInpEyekdlr10GWshvHu:APA91bHV......

所以,转移应用程序后,我只需要转移appleUserId。

关于如何生成转移标识符的文档也很混乱,因为不清楚是否需要为所有用户生成转移标识符以及如果用户在他们提到的 60 天内未登录应用程序该怎么办转移后。

我完全同意你的看法,这很令人困惑。

无论如何,这是迁移 appleUserId 的步骤。

  1. 获取访问令牌以迁移用户 ID(针对发件人)
  2. 生成传输标识符(使用发送者访问令牌)
  3. 获取访问令牌以迁移用户 ID(用于收件人)
  4. 通过传输标识符查找新用户 ID(使用接收者访问令牌)

由于只有 1000 个用户使用苹果登录到我的系统。 我创建了一个 bash 脚本,该脚本调用 API 来一一转换用户 ID。

这是我检索“传输标识符”的脚本。

#!/bin/bash
generateTransferIdFunc() {
APIURL="https://appleid.apple.com/auth/usermigrationinfo"
recipientTeamId=7253******
senderAppBundleID=com.test.app
senderSecret=eyJraWQiOiJBQTQ4NkJaWTUyIiw.........

if [ $# -eq 1 ] && [ -f $1 ]
then
OLDIFS=$IFS
IFS=","
while read oid userid email
do
        echo "Start retrieving trasfer_sub for : $userid, $email"
curl -sS --location --request POST $APIURL \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer ae42b9xxxxxxxxxxxxxxxxxxxxxxxxxxx.0.xxxxx.4xxxxxxxxxxxxxxxxxxxxx' \
-d "sub=$userid&target=$recipientTeamId&client_id=$senderAppBundleID&client_secret=$senderSecret"

        echo ""
        echo "End."
done < $1
IFS=$OLDIFS
else
        echo "Input file not found!"
fi
}


if [ $# -eq 1 ] && [ -f $1 ]
then
generateTransferIdFunc $1 | while IFS= read -r line; do printf '%s %s\n' "$(date '+%Y-%m-%d %H:%M:%S.%N')" "$line"; done | tee -a generateTransferId.log 
else
       echo "Input file not found!"
fi

注意:senderSecret 由 JWT 生成。 请参阅https://medium.com/identity-beyond-borders/how-to-configure-sign-in-with-apple-77c61e336003

您可以通过以下方式运行脚本

sh generate_transfer_identifier.sh input.csv 

这是示例输入。csv

oid,appleId,email
129914891,001870.1ffcf5**************************.0729,a********@privaterelay.appleid.com
129985693,001559.8322cd**************************.0728,b********@privaterelay.appleid.com

然后您将收到每个用户的“传输标识符”。

之后,您可以使用“传输标识符”来检索与收件人团队一起使用的新用户 ID。 请阅读本文以将“传输标识符”转换为新的用户 ID。 https://developer.apple.com/documentation/sign_in_with_apple/bringing_new_apps_and_users_into_your_team

注意:您可以修改上面的脚本调用一个 API 来转换它。

最后,您将收到新的用户 ID。 然后,您只需要将用户 ID 更新到您的数据库中。

我希望以上信息对您有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM