How to keep the user logged in or check if the user is logged in or not in Shopify?
<p>Hi I used the following code to login a user in Shopify.</p>

<pre><code>NSArray *items = @[[BUYAccountCredentialItem itemWithEmail:email], [BUYAccountCredentialItem itemWithPassword:password]];
        BUYAccountCredentials *credentials = [BUYAccountCredentials credentialsWithItems:items];

        [self.client loginCustomerWithCredentials:credentials callback:^(BUYCustomer * customer, BUYCustomerToken * token, NSError * _Nullable error) {
            if (customer &amp;&amp; !error) {

                NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
                [prefs setObject:token.accessToken forKey:@"CustomerToken"];


                [prefs setInteger:[token.customerID integerValue] forKey:@"CustomerId"];
                [prefs synchronize];



                NSLog(@"Success fully loged in token %@ %@",token.accessToken,token.customerID);
                UINavigationController *navigationController = self.navigationController;
                [navigationController popViewControllerAnimated:YES];

            }else{
                [self showEror:@"LogIn Failed" message:@"Please provide valid Details"];
            }
        }];
</code></pre>

<p>Every time I have to login and proceed further. I stored token and customerId in local. How can I make sure that user automatically log in when app opens unless they doesn't logout. Thank you.</p>