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

Could not grant token #18

Open
yetdog opened this issue Apr 28, 2021 · 2 comments
Open

Could not grant token #18

yetdog opened this issue Apr 28, 2021 · 2 comments

Comments

@yetdog
Copy link

yetdog commented Apr 28, 2021

Things broke around Dec 2020, getting this response in my error_log table:

{
	"code": 0,
	"message": "Could not grant token",
	"file": "\/opt\/sqlbee\/sqlbee.php",
	"line": 219,
	"backtrace": [{
		"file": "\/opt\/sqlbee\/sqlbee.php",
		"line": 123,
		"function": "refresh_token",
		"class": "sqlbee\\sqlbee",
		"type": "->",
		"args": ["mVYICl5iOcaQWvQb2l5mhz894AFkXTQU"]
	}, {
		"file": "\/opt\/sqlbee\/sqlbee.php",
		"line": 252,
		"function": "ecobee",
		"class": "sqlbee\\sqlbee",
		"type": "->",
		"args": ["GET", "thermostatSummary", {
			"body": "{\"selection\":{\"selectionType\":\"registered\",\"selectionMatch\":\"\"}}"
		}]
	}, {
		"file": "\/opt\/sqlbee\/setup.php",
		"line": 78,
		"function": "get_thermostat_summary",
		"class": "sqlbee\\sqlbee",
		"type": "->",
		"args": []
	}]
}

Tried going through a new app / PIN setup. Same deal. The "args" section of the json response changes when I use a new registration, but other than that stays the same. Setup.php process fails at "syncing..." with same error_log entry.

@ziebelje
Copy link
Owner

This is an ecobee error saying they're having trouble refreshing or getting a new access token. Can you update to the latest version of the project and try again? You should be able to use the same database and ecobee app; just truncate the token table and do the authorization again.

@rnoser
Copy link

rnoser commented Jun 20, 2021

I've had the same issue since the JWT change mentioned in the Ecobee API dox below. I tried again this morning with the most current code set with no luck.

Access Tokens

Access tokens will now always be returned as JWTs, which are longer than our legacy 32 character format, and use a much wider character set. Note that token and PIN changes affect /token and /authorize requests, as well as the Authorization: Bearer header for all other requests.

To ensure that your application will continue to work after December 1, 2020, the following steps will need to be taken:

Update your application so it can handle tokens up to 7KB in length which can include upper and lower case alphanumeric characters, hyphens, underscores, and periods (we use JSON Web Signature tokens following RFC7515).
Link to API docs

I can hack away in PHP and was once able to track back to the lines of code the above would refer to, but I wasn't able to make a successful change. I'd be more than happy to help troubleshoot this with anyone interested.

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

3 participants