使用Apple登录-Exchange标识符-请求无效

问题描述

我们尝试在2个团队之间交换“用苹果登录”,我们进行如下操作:

旧团队为新团队生成一个transfer_sub,这里的请求(https://developer.apple.com/documentation/sign_in_with_apple/transferring_your_apps_and_users_to_another_team)如下所示:

curl -sS --location --request POST "https://appleid.apple.com/auth/usermigrationinfo" \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
-d "sub=$oldUserSub&target=$newTeamId&client_id=$oldAppBundleID&client_secret=$oldSecret"

这很好用,旧团队收到了transfer_sub并将其交给新团队。

{"transfer_sub":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}

新团队通过以下请求(https://developer.apple.com/documentation/sign_in_with_apple/bringing_new_apps_and_users_into_your_team)获得新ID:

curl -sS --location --request POST "https://appleid.apple.com/auth/usermigrationinfo" \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
-d "transfer_sub=$transferSubFromOldTeam&client_id=$newAppBundleID&client_secret=$newSecret"

不幸的是,这不起作用,因为返回错误

{"error":"invalid_request"}

有人知道如何使保级有效吗?

解决方法

您已经转移了应用程序吗?

相同的问题已经在开发者论坛中得到解决。

引用here可以解决此问题。

答案说:

在转移应用程序之前,您不能使用URL的api“ / auth / usermigrationinfo”。

因此,如果您尚未转移应用,则必须先完成应用转移。然后,新团队将可以通过以下请求获取新ID:

curl -sS --location --request POST "https://appleid.apple.com/auth/usermigrationinfo" \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
-d "transfer_sub=$transferSubFromOldTeam&client_id=$newAppBundleID&client_secret=$newSecret"