In my application I can identify user by providerId and providerUserId. But initially, I have only following information:
- providerId,
- accessToken,
- secret.
Thus, I need to acquire providerUserId by this information.
I'm trying to use following code:
ConnectionData connectionData = newConnectionData(providerId, accessToken, secret);
ConnectionFactory<?> connectionFactory = connectionFactoryLocator.getConnectionFactory(providerId);
Connection<?> connection = connectionFactory.createConnection(connectionData);
if(connection.test()) {
connection.sync();
} else {
throw new AuthException();
}
return userEntityService.findOneByConnectionKey(connection.getKey());
But problem is that connection key is not initialized: providerUserId is null.
How can I acquire it in this case?