Waiting for Authentication

Since access tokens are requested over a network connection the request takes some time to complete.

If you attempt to add the Live Experience widget before you have a valid token, the widget will fail to appear in your app. Therefore you need to keep track of the authentication process and wait for it to complete before placing your widget. Network requests happen in a background thread so your app will not wait and continue to run during this time. You will need some kind of notification, callback, or completion handler to let you know when the token has been fetched.

Here is an example of using a completion handler in Swift on iOS to wait for authentication before placing the widget:
fetchToken() {
 Controller.shared.addComponent(viewController: view)
}