I am trying to implement google server to server authentication using oAuth For that i generated credentials according to steps mentioned and them google gave me json file with below details
// this is sample data not real data
{
"type": "service_account",
"project_id": "myapp",
"private_key_id": "17af28d89ef88g59e9c44a51csf00f894c23",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCYTyEAeQxHUP66[OTHER TEXT REMOVED]n-----END PRIVATE KEY-----\n",
"client_email": "someemailname@projectname.iam.gserviceaccount.com",
"client_id": "3246344567234535",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/meshpresentations%40meshslides.iam.gserviceaccount.com"
}
The i used "private_key" in jwt.io like shown in image below, but its showing "Invalid signature", is it because only server who provided me private key (google) can verify if its a valid token on not ? If so them when i fire a curl call i get another error.
{
“error”: “invalid_grant”,
“error_description”: “Invalid JWT: Token must be a short-lived token and in a reasonable timeframe”
}
What am i missing ? I am not even sure if i have made JWT token wrongly or some other problem is there. PS : i am a learner.