---
title: authenticateHandler
framework: gamekit
role: symbol
role_heading: Instance Property
path: gamekit/gklocalplayer/authenticatehandler
---

# authenticateHandler

A handler that GameKit calls while initializing the local player.

## Declaration

```swift
var authenticateHandler: ((UIViewController?, (any Error)?) -> Void)? { get set }
```

```swift
var authenticateHandler: ((NSViewController?, (any Error)?) -> Void)? { get set }
```

```swift
var authenticateHandler: (((any Error)?) -> Void)? { get set }
```

## Parameters

- `viewController`: A view controller that your game presents to the local player so they can perform any necessary actions to finish initialization, or nil if the initialization process is complete.
- `error`: Describes an error if it occurs, or nil if the operation completes.

## Mentioned in

Authenticating a player Initializing and configuring Game Center

## Discussion

Discussion Before you can access any Game Center data and use GameKit features, you need to initialize the local player to ensure the player signs in to Game Center on the device running your game. Set this property to a method that GameKit invokes during the initialization process. If viewController is nil, Game Center initializes the player and the player can start your game. Otherwise, present the view controller so the player can perform any additional actions to complete the process. Game Center may show a brief initialization screen if the player isn’t already signed into Game Center. For more information about initializing Game Center with a local player, see Authenticating a player.

## See Also

### Authenticating the Local Player

- [isAuthenticated](gamekit/gklocalplayer/isauthenticated.md)
- [fetchItems(forIdentityVerificationSignature:)](gamekit/gklocalplayer/fetchitems(foridentityverificationsignature:).md)
- [GKPlayerAuthenticationDidChangeNotificationName](foundation/nsnotification/name-swift.struct/gkplayerauthenticationdidchangenotificationname.md)
