Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check for valid user session

Tags:

ios

quickblox

Does the QuickBlox SDK for iOS include a method for checking / storing a valid user session?

Unless the user has specifically logged out, they should be automatically logged back in. Does the SDK have a built in mechanism for dealing with this or do I need to store the username and password, if I'm storing the info what needs to be stored for a FB login?

like image 350
goto_10 Avatar asked Dec 06 '25 14:12

goto_10


1 Answers

For example, you created session with facebook login

QBASessionCreationRequest *extendedAuthRequest = [QBASessionCreationRequest request];
extendedAuthRequest.socialProvider = @"facebook";
extendedAuthRequest.socialProviderAccessToken = @"BAAE74iZBvNR0BAFCnyIIvdbdslDZCbIyzqDtT1oWg4dYYQoUl2tsBGMAZCFJX1x2x0h116OF0rObZC3WwtjjtS9rHiwcsvwvlI4pk0RTObCZAvkfUZCGxatsLykeWmC4";

[QBAuth createSessionWithExtendedRequest:extendedAuthRequest delegate:self];

Your session will be expired in 2 hours after last request to QuickBlox API. And next, you will get "Required session does not exist"

you should recreate session manually in this case (i mean repeat above query)

To check session expiration date use next snippet:

NSDate *sessionExpiratioDate = [QBBaseModule sharedModule].tokenExpirationDate;
like image 199
Rubycon Avatar answered Dec 08 '25 15:12

Rubycon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!