Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token refresh fails #7

Open
syslogic opened this issue Dec 24, 2021 · 1 comment
Open

Token refresh fails #7

syslogic opened this issue Dec 24, 2021 · 1 comment

Comments

@syslogic
Copy link
Contributor

syslogic commented Dec 24, 2021

In method refresh_token() it is being assumed that an array is being returned, which is not the case:

array_key_exists("access_token", $result)

Therefore it should rather be:

property_exists($result, "access_token")

Previously type-checking the $result could prevent passing the wrong data-type:

if (
    $result == null ||
    is_array($result) && !array_key_exists("access_token", $result) ||
    is_object($result) && !property_exists($result, "access_token")
)  {
    return null;
}
syslogic added a commit to syslogic/hms-push-serverdemo-php that referenced this issue Dec 25, 2021
@Mike-mei
Copy link
Contributor

We have verified that array_KEY_EXISTS ("access_token", $result) is common to the property_exists($result, "access_token") function in this scenario, so there's no need to modify that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants