The response I get from getCredentials does not seem to contain any function for accessTokenExpired. When I print_r the $session, I see an access token expiry UNIX time, and an index “accessTokenExpired”, with nothing set to it, and calling that method I get an error confirming:
Call to undefined method stdClass::accessTokenExpired()
I’m super confused because this seems like a well documented method that should exist? It’s baffling to me. I’m also confused about how I’m supposed to know when a new session has been started, and the existing one has been killed - how can I kill the existing session if, for example, someone else logged in with the same credentials on another computer?
Sorry for the confusion! getCredentials() returns an object representing the state of the session but not a class that would contain functions. In this case, you would use:
$sessionExpirey = $session->accessTokenExpired, which will be a boolean.
Right, it will return true when the authenticated session has expired, but false in all other cases. (Unless there isn’t an authenticated session at all, in which case getCredentials() returns null anyway.)