Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error : Error getting access token for service account: Remote host terminated the handshake, iss: #49

Open
dineshsraman opened this issue Jan 29, 2024 · 0 comments

Comments

@dineshsraman
Copy link

I'm using below Java snippet to get the Authentication token for Firebase Messaging. But its throwing error during refreshIfExpired method call.

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();
    
	}

When i remove refreshIfExpired and call getAccessToken directly also same error is coming. Any suggestion. Are these related to jars? As i have uploaded certain jars downloaded from Maven as i do not find anything on google firebase link.

Error at refreshIfExpired step: Error getting access token for service account: Remote host terminated the handshake, iss: firebase-adminsdk-jnf15@***

@dineshsraman dineshsraman changed the title Error : Error getting access token for service account: Remote host terminated the handshake, iss: firebase-adminsdk-jnf15@ Error : Error getting access token for service account: Remote host terminated the handshake, iss: Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant