Search code examples
google-apigoogle-glassgoogle-mirror-api

Mirror API invalid_grant


I'm trying to use Service Account on Mirror API to call a PHP script on my server to push card into Glass Timeline.

Actually I just get a JWT, but when I perform the POST Request to get my token, Google sends me:

> ' https://accounts.google.com/o/oauth2/token
{
  "error" : "invalid_grant"
}

I don't really know why. I use this line as Grant_type : grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer

If you get some information... Thx


Solution

  • You cannot use a service account to send data to the Mirror API.

    Each call to the Mirror service requires it to be made on behalf of a specific user that has authorized you access to their Glass Timeline. You must use the access token generated by a specific user's oauth permissions to do so.

    Google describes a service account as "an account that belongs to your application instead of to an individual end user", while each Glass is associated with a specific end-user account.