get token fix

This commit is contained in:
Efstratios Giannopoulos 2024-05-21 12:21:42 +03:00
parent 1a75344727
commit f716b0b0b1
2 changed files with 5 additions and 3 deletions

View File

@ -16,9 +16,11 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.MultipartBodyBuilder;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.MultiValueMapAdapter;
import org.springframework.util.ResourceUtils;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.HttpServerErrorException;
@ -289,7 +291,7 @@ public class ZenodoDepositServiceImpl implements ZenodoDepositService {
exchangeFilterFunctions.add(logResponse());
}).defaultHeaders(httpHeaders -> {
httpHeaders.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
httpHeaders.setContentType(MediaType.MULTIPART_FORM_DATA);
httpHeaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
}).build();
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
@ -298,7 +300,7 @@ public class ZenodoDepositServiceImpl implements ZenodoDepositService {
map.add(GRANT_TYPE, AUTHORIZATION_CODE);
map.add(CODE, code);
map.add(REDIRECT_URI, depositConfiguration.getRedirectUri());
try {
logger.debug(new MapLogEntry("Get Access Token")
.And("url", depositConfiguration.getRepositoryAccessTokenUrl())

View File

@ -9,6 +9,6 @@ ZENODO_CLIENT_SECRET=cvTkkzmfkO7OBYIJQ2ZEWfc309ELwJBJe3rtOHZL2ITcX27woE7IUAw5NMs
ZENODO_ACCESS_TOKEN=uUwXiySNn637uWQpcsfOtifsmLfP0lgp0N8uOssppb7ajeJCq5WicHbcC2Vk
ZENODO_URL=https://sandbox.zenodo.org/api/
ZENODO_RECORD_URL=https://sandbox.zenodo.org/record/
REDIRECT_URL=http://localhost:4200/login/external/zenodo
REDIRECT_URL=http://localhost:4200/deposit/oauth2/code-callaback
STORAGE_PATH=/storage