User not signed into Firebase in Share App Extension

前端 未结 3 1762
囚心锁ツ
囚心锁ツ 2020-12-16 23:17

I am making some API Firebase calls (download some user specific data) in my app share extension but the user is not signed into Firebase (aka currentUser is ni

3条回答
  •  死守一世寂寞
    2020-12-17 00:05

    The existing answers did not fix it for me, but I did find this official FireBase documentation.

    In summary, the fix was using the app groups capability with same identifier in the app and extension.

    Then including the code:

    do {
      try Auth.auth().useUserAccessGroup("TEAMID.com.example.group1")
    } catch let error as NSError {
      print("Error changing user access group: %@", error)
    }
    

    In my tests the authenticated user has the same uid in the main app and the share extension.

    HTH

提交回复
热议问题