0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

firebaseエミュレーターにIOSの実機から接続する

Last updated at Posted at 2023-02-04

Flutterで認証周りの実装をFirebaseで行っていた際に、Firebaseエミュレーター(Auth)へ、実機のiosからなかなか繋がらなくて四苦八苦したので備忘録として残す

環境として、開発に使っているmacとios(実機)は同一ネットワークに存在してる。

firebaseの設定

// firebase.json
{
  "emulators": {
    "auth": {
      "host": "0.0.0.0",
      "port": 9099
    },
    "ui": {
      "enabled": true
    },
    "singleProjectMode": true
  }
}

class Authentication {
  static Future<void> initialize() async {
    WidgetsFlutterBinding.ensureInitialized();
    await Firebase.initializeApp();

    if (kDebugMode) {
      await FirebaseAuth.instance.useAuthEmulator('192.168.1.8', 9099);
    }
  }
}

ここで興味深いのはfirebaseでのホストとflutterでのホストの設定が違うところ。
ちなみに私はこのツイートに救われた

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?