简体   繁体   English

用于生产时,Firebase Auth Phone无法正常工作

[英]Firebase Auth Phone not working when using for production

So I have successfully set up Firebase Messaging and push notification works great. 因此,我已经成功设置了Firebase Messaging,并且推送通知效果很好。 However, when I add Firebase Auth for phone, only sandbox works. 但是,当我为电话添加Firebase Auth时,仅沙箱有效。 Below is my code: 下面是我的代码:

-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
    [[FIRAuth auth] setAPNSToken:deviceToken type:FIRAuthAPNSTokenTypeSandbox];
}

When using FIRAuthAPNSTokenTypeSandbox, [[FIRPhoneAuthProvider provider] verifyPhoneNumber:phoneNumber...] will work. 使用FIRAuthAPNSTokenTypeSandbox时,[[FIRPhoneAuthProvider提供程序] verifyPhoneNumber:phoneNumber ...]将起作用。 However, when I use FIRAuthAPNSTokenTypeProd, I will get internal server error. 但是,当我使用FIRAuthAPNSTokenTypeProd时,会出现内部服务器错误。 I have uploaded both Development and Production certificates on my Firebase console, and push notification works great when users download my app through Test Flight. 我已在Firebase控制台上上传了开发证书和生产证书,并且当用户通过Test Flight下载我的应用程序时,推送通知效果很好。

My question is why is this the case, and how would I be able to fix it? 我的问题是为什么会这样,我将如何解决? I am afraid if I keep using sandbox, some future users will not be able to receive the SMS messages, but at the same time, production doesn't work. 恐怕如果我继续使用沙箱,将来的某些用户将无法接收SMS消息,但是同时生产无法正常进行。

Another question I have is, will I be able to localize and customize my SMS messages? 我还有一个问题,我是否可以本地化和自定义SMS消息? I will be sending these codes to users in multiple countries. 我将这些代码发送给多个国家/地区的用户。

If anyone knows the answer that would be great! 如果有人知道答案,那就太好了! Thanks in advance! 提前致谢!

Answer for your First Question : 回答第一个问题:

  1. When I add Firebase Auth for phone, only sandbox works. 当我为手机添加Firebase Auth时,仅沙箱有效。

Please have in mind, about the type of certificate you are using while sharing the build, 请注意,关于共享版本时您使用的证书类型,

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {

    // If you are using the development certificate you have to use this,
        [[FIRAuth auth] setAPNSToken:deviceToken type:FIRAuthAPNSTokenTypeSandbox];

    // If you are using distribution certificate you should use this
        [[FIRAuth auth] setAPNSToken:deviceToken type:FIRAuthAPNSTokenTypeProd];

    // If you want Firebase to automatically detect the type use this.
        [[FIRAuth auth] setAPNSToken:deviceToken type:FIRAuthAPNSTokenTypeUnknown];

    }
  1. a) Localize : Yes you can. a)本地化:可以。

[[FIRAuth auth] useAppLanguage]; Ref: Firebase Phone Number Auth Document 参考: Firebase电话号码验证文档

  b) Customize my SMS messages : No you can't. 
  As this may abuse the user experience. Got clarification from Firebase as "Those templates can't be edited, sorry. There is a good deal of concern that this service could be abused and used for spam and other bad practices."

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

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