java - 400 Error "error_description" : "Invalid grant_type: urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer" Google Service account -
i following tutorial https://developers.google.com/accounts/docs/oauth2serviceaccount authorise application. have created jwt following tutorial.
but when make access token request keep on getting "invalid grant_type: urn%3aietf%3aparams%3aoauth%3agrant-type%3ajwt-bearer" exception.
here code make request
httpclient httpclient = new httpclient(); postmethod post = new postmethod("https://accounts.google.com/o/oauth2/token"); post.addrequestheader("content-type", "application/x-www-form-urlencoded"); post.addparameter("grant_type", urlencoder.encode("urn:ietf:params:oauth:grant-type:jwt-bearer", "utf-8")); post.addparameter("assertion", "jwt including signature."); httpclient.executemethod(post);
i have looked @ lot of resources bu obvious error seems mistaking client id email id. however, have checked , re-cheeked make sure using correct one.
please can tell me doing wrong.
many thanks
i solved referring post: invalid grant error being thrown while retrieving accesstoken google service account request.
turns out there problem ntp(network time protocol). expiration time , issued @ time had changed. after did that, start work properly.
Comments
Post a Comment