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:
Example of an infinite scroll in Laravel and Vue JS Example of an infinite scroll in Laravel and Vue JSI'll show you how to make infinite scroll pagination with vue js and Laravel 5.6 in this post… Read More
Laravel Dynamic Dependent Dropdown using VueJS and PHPBy and large, Unique Ward Select Box is utilized for auto-populate a dropdown list on Dependant information. At the point when you select one drop-dow… Read More
Laravel 9 Dynamic Form Validation in VueJs with PHP Today market, vue js become more well known. so today I need to impart to you how to add dynamic information structure approval utilizing php la… Read More
Laravel 9 Dynamic Ajax Autocomplete using Vue.js Today, we will learn ajax live hunt and autocomplete involving vue js parts in laravel 5.6 application. here we will make straightforward and pl… Read More
Laravel Vue JS PaginationToday, I might want to impart to you how to make laravel vue pagination without any preparation. We will make dynamic pagination with vue.js. We will … Read More
0 comments:
Post a Comment
Thanks