Fix get default token issues

revert-70ac1926
shamalka 5 years ago
parent 2adda8ba6d
commit 2ec29701a1

@ -1338,7 +1338,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
@GET
@Path("/{clientId}/{clientSecret}/default-token")
@Override
public Response getDefaultToken(String clientId, String clientSecret) {
public Response getDefaultToken(@PathParam("clientId") String clientId, @PathParam("clientSecret") String clientSecret) {
JWTClientManagerService jwtClientManagerService = DeviceMgtAPIUtils.getJWTClientManagerService();
try {
JWTClient jwtClient = jwtClientManagerService.getJWTClient();

@ -104,10 +104,10 @@ public class DefaultTokenHandler extends HttpServlet {
newDefaultAuthData.setClientId(clientId);
newDefaultAuthData.setClientSecret(clientSecret);
String defaultToken = jTokenResultAsJsonObject.get("access_token").getAsString();
String defaultToken = jTokenResultAsJsonObject.get("accessToken").getAsString();
newDefaultAuthData.setAccessToken(defaultToken);
newDefaultAuthData.setRefreshToken(jTokenResultAsJsonObject.get("refresh_token").getAsString());
newDefaultAuthData.setScope(jTokenResultAsJsonObject.get("scope").getAsString());
newDefaultAuthData.setRefreshToken(jTokenResultAsJsonObject.get("refreshToken").getAsString());
newDefaultAuthData.setScope(jTokenResultAsJsonObject.get("scopes").getAsString());
httpSession.setAttribute(HandlerConstants.SESSION_DEFAULT_AUTH_DATA_KEY, newDefaultAuthData);
HandlerUtil.handleSuccess(resp, constructSuccessProxyResponse(defaultToken));

Loading…
Cancel
Save