AppleSignIn(与Firebase和Expo一起)在本地工作,但不能独立工作



我在我的世博会应用程序上实现了 signinWithApple 按钮,当我在 Firebase 身份验证选项卡中使用host.exp.ExponentonServices ID进行 Apple 登录时,它在本地运行良好。

但是当我创建一个独立的应用程序并使用 TestFlight 对其进行测试时,无论我在Services ID上使用host.exp.Exponent、 什么都没有或my specific app service ID,它都不再起作用。

我在这里错过了什么?

我的代码 :

handleApple = async () => {
const csrf = Math.random().toString(36).substring(2, 15);
const nonce = Math.random().toString(36).substring(2, 10);
try {
const appleCredential = await AppleAuthentication.signInAsync({
requestedScopes: [
AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
AppleAuthentication.AppleAuthenticationScope.EMAIL
],
state: csrf,
nonce: nonce
});
const {
identityToken,
fullName,
email
} = appleCredential;
if (identityToken) {
// login with credential
const provider = new firebase.auth.OAuthProvider("apple.com");
const credential = provider.credential({
idToken: identityToken,
rawNonce: nonce,
});
await firebase.auth().signInWithCredential(credential).then(user => {
...

编辑:

我设法通过在 Firebase 的字段中使用my bundle identifier(这也是我的应用程序 ID(the Service ID使其工作。

错误代码 :

错误:ID 令牌 [##.app-视频] 中的观众与预期的观众 ##.sign 不匹配。

但是现在在我的网站上使用Apple登录中断了。 当我将"服务 ID"字段更改为my specific app service ID(在Identifiers>Services IDs中找到(时,我设法使其工作。

所以我被困在一个需要某些东西的应用程序和一个需要另一个东西的网站上。为什么?

在重新生成应用时,我是否应该执行特定操作,以便考虑对 mu 标识符所做的更改? 我正在使用这个,这还不够吗?

expo build:ios --clear-provisioning-profile

我遇到了同样的问题,应该通过以下方式解决它。

您必须在 Firebase 控制台中重新创建GoogleService-info.plist,其捆绑 ID 与 Xcode 中的项目中的 bundle ID 相同。

最新更新