Archive for February, 2015

Google API SDK OAuth2 Authentication “Invalid_Grant”

After hours of searching and not finding any information on the topic, I wanted to prevent a headache for the next guy who has to code against Google’s user directory API.

If you’ve had a solution working for a while, and all of a sudden your logs start to be filled with errors like this:

Google.Apis.Auth.OAuth2.Responses.TokenResponseException: Error:”invalid_grant”, Description:””, Uri:””
at Google.Apis.Requests.ClientServiceRequest`1.Execute()

The solution is as simple as checking the time is synchronized to match what Google has. If your server has a time that is even 1 minute in the future off, Google will send an exception of “Invalid_Grant” due to a request claiming to come from the future.

*Edit*: Found info on Google here.


Response To The Alberta Government Survey

I recently filled out the survey from the Alberta Government which you can find here. I sent in the following response:

The AB Government should make the heritage fund legislation much more difficult to be tampered with by future politics than the original legislation was. Set aside a minimum 15% of non-renewable resource revenue to the fund. The fund must invest outside of Canada, be diversified outside of oil, and managed outside of, but overseen by, the government.

A benchmark must then created for when oil revenues are above or below the benchmark. If oil revenues are above the benchmark, interest must be reinvested/compounded. If oil is below, interest can be used to fund programs. No principal withdrawals allowed until interest is equivalent to ~5 Billion CAD adjusted with inflation as of the day legislation is passed. Principal spending cannot reduce fund value to project less than 5 billion interest based on historical returns. Next year’s available heritage money for use is calculated by the previous years’ interest accrued as of year-end.

Until oil rebounds, allow a deficit and small reductions in program spending with the intention that the above will level future downturns.

I choose to believe this survey is for the purpose of retrieving data and not just gaining political capital. So hopefully they’ll read it!

Return top


I do not adhere to a schedule. I post when I have something to say. I'm a programmer who in my spare time enjoys contemplating the meaning of life, the universe and, everything. So there will be code as well as random little stories, essays and, musing about whatever interests me at the moment.