title: Swift Signing User in with Access Group not working
body: <p>Inside my app I would like to sign in the user using <code>Auth.auth().useUserAccessGroup</code>.</p>
  <p>This is my code for signing in with email (user can also sign in with Facebook, Google &amp; Apple):</p>
  <p><strong>signUp-Function:</strong></p>
  <pre><code>static func signUpWithEmail(email: String, password: String, username: String, finished: @escaping (_ done: Bool) -&gt; Void){
      
      do {
          try Auth.auth().useUserAccessGroup(&quot;SN26HDFT24.com.wishlists-app.group&quot;)
      } catch let error as NSError {
          print(&quot;Error changing user access group: %@&quot;, error)
      }
      Auth.auth().createUser(withEmail: email, password: password) { (result, error) in
          
          if let error = error {
              Utilities.showErrorPopUp(labelContent: &quot;Fehler&quot;, description: error.localizedDescription)
              finished(false)
          }
          
          if let userId = result?.user.uid { 
  
               // successfully signed in
  
          } else {
              print(&quot;user couldn't sign in&quot;)
              finished(false)
          }
      }
  }
  </code></pre>
  <p><strong>Keychain Sharing:</strong></p>
  <p><a href="https://i.stack.imgur.com/vmCxw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vmCxw.png" alt="asdf" /></a></p>
  <p><strong>Problem:</strong></p>
  <p>When calling this function <code>if let error = error</code> this fails:</p>
  <blockquote>
  <p>The @c NSLocalizedFailureReasonErrorKey field in the @c NSError.userInfo dictionary will contain more information about the error encountered&quot; UserInfo={FIRAuthErrorUserInfoNameKey=ERROR_KEYCHAIN_ERROR, NSLocalizedFailureReason=SecItemCopyMatching (-34018), NSLocalizedDescription=An error occurred when accessing the keychain. The @c NSLocalizedFailureReasonErrorKey field in the @c NSError.userInfo dictionary will contain more information about the error encountered}</p>
  </blockquote>
  <p>so the first time I am calling it, <code>try Auth.auth().useUserAccessGroup(&quot;SN26HDFT24.com.wishlists-app.group&quot;)</code> actually succeeds, at least it is not throwing anything.</p>
  <p>But when calling it again it the <code>do try block</code> fails. With the same error-message as above.</p>
  <p><strong>Entitlements:</strong></p>
  <p><a href="https://i.stack.imgur.com/Kb7SD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kb7SD.png" alt="enter image description here" /></a></p>
  <p><strong>Capabilities:</strong></p>
  <p><a href="https://i.stack.imgur.com/EiFtI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EiFtI.png" alt="enter image description here" /></a></p>
  <p>I am stuck. Couldn't find anything on this anywhere...</p>
  <p><em><strong>This is for my Share Extensnion:</strong></em></p>
  <p><a href="https://i.stack.imgur.com/RC9Zi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RC9Zi.png" alt="enter image description here" /></a></p>