Solve potential crash by storing credentials in the main thread