I'm using below Java snippet to get the Authentication token for Firebase Messaging. But its throwing error during refreshIfExpired method call.
Java code:
private static String getAccessToken() throws IOException {
String[] SCOPES = {"
https://www.googleapis.com/auth/firebase.messaging"};
/>
GoogleCredentials googleCredentials = GoogleCredentials.fromStream(new FileInputStream("./src/service-account.json")).createScoped(Arrays.asList(SCOPES));
//googleCredentials.refresh();
try {
googleCredentials.getAuthenticationType();
googleCredentials.refreshIfExpired();
} catch (IOException e) {
e.printStackTrace();
}
return googleCredentials.getAccessToken().getTokenValue();
}
Cause: javax.net.ssl.SSLHandshakeException: Remote host terminated the handshake.
Detailed Error: Error getting access token for service account: Remote host terminated the handshake, iss: firebase-adminsdk-jnf15@
Are these errors related to jars or certificates? As per Firebase documentation, they did not mentioned anything related to Certificates.your text
Java Snippet code from documentation link :
https://firebase.google.com/docs/cloud-messaging/migrate-v1#use-credentials-to-mint-access-tokens
/>
The getAccessToken() method was shared in Google Firebase API documentation and same was used by uploaded certain jars which are required.
This service supposed to return the Access Token which will be used in subsequent service as Bearer token to send the Notifications to devices in REST API call. But this service is not working as expected and returning error.
Error : Error getting access token for service account: Remote host terminated the handshake, iss
Programing Coderfunda
January 29, 2024
No comments
Related Posts:
Weekly /r/Laravel Help ThreadAsk your Laravel help questions here. To improve your chances of getting an answer from the community, here are some tips: * What steps have you ta… Read More
laracon US 2023 lodgingI'm stoked laracon US is back in person. One of my favorite parts of laracon in years past is how rad the community is, and I loved it when everyone w… Read More
Laravel Vapor application observability with InspectorAn extended tutorial on integrating Inspector observability platform to monitor your Laravel application deployed with Vapor. The post Laravel Vapo… Read More
Going past Actions in LaravelOver the last year or so, the Action based approach has been gaining popularity in the Laravel world. I was a big fan of this and adopted it relativel… Read More
SpinLock VB.Net Example From MSDN Possibly Produces Incorrect BehaviourThe code below is part of an example from MSDN. It is the example on how to use SpinLock but to my eye there is a race condition in it. Why I think th… Read More
0 comments:
Post a Comment
Thanks