【问题标题】:Appwrite sms authentication connection times outAppwrite短信认证连接超时
【发布时间】:2023-01-25 09:11:15
【问题描述】:

我想使用 appwrite 在我的 flutter 应用程序上启用电话身份验证。我遵循了官方指南,更改了 appwrite 的 .env 变量并使用 docker compose up -d 以正确的凭据重新启动 appwrite。作为 SMS 提供商,我使用 text-magic 因此我的 .env 文件具有以下 SMS 配置:

_APP_SMS_PROVIDER=sms://[USERNAME]:[API-KEY]@text-magic
_APP_SMS_FROM=+123456789

用户名和API-Key来自textmagic

此外,我创建了一个简单的方法来创建电话会话。

createPhoneSession(String phonenumber) async {
    try {
      Client client = Client();
      client
          .setEndpoint(AppConstants.endpointId)
          .setProject(AppConstants.projectId);
      Account account = Account(client);
      var token = await account.createPhoneSession(userId: ID.unique(), phone: phonenumber);
      print(token.$id);
    } catch (error) {
      print(error);
    }
  }

我得到的异常如下: I/flutter ( 5195): AppwriteException: null, Connection timed out (0)

有什么建议为什么它会超时吗?提前谢谢你的帮助!

【问题讨论】:

  • 基本上我为我的appwrite连接使用了错误的IP地址......

标签: flutter appwrite


【解决方案1】:

正如您提到的,端点不正确。在本地开发时,您不能将 localhost 用作端点,因为移动设备将尝试连接到自身而不是 Appwrite。您可以使用您的 LAN IP 而不是本地主机。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-12-06
    • 2013-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多