Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
poonwu committed Sep 20, 2016
1 parent d2c150c commit c01926e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/com/ahancer/rr/services/InstagramService.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
import org.jinstagram.exceptions.InstagramException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;

import com.ahancer.rr.daos.MediaDao;
import com.ahancer.rr.exception.ResponseException;
import com.ahancer.rr.response.AuthenticationResponse;
import com.ahancer.rr.response.InstagramProfileResponse;
import com.ahancer.rr.response.OAuthenticationResponse;
Expand Down Expand Up @@ -111,8 +113,17 @@ public Instagram getInstance(String accessToken) {
}
public OAuthenticationResponse authenticate(String accessToken) throws Exception {
Instagram instagram = getInstance(accessToken);
Instagram instagram2 = getInstance(getAdminAccessToken());
UserInfoData userInfo = instagram.getCurrentUserInfo().getData();

try{
if(instagram2.getUserInfo(userInfo.getId()).getData() == null) {
throw new ResponseException(HttpStatus.BAD_REQUEST, "error.influencer.media.instagram.notpublic");
}
} catch(Exception e) {
throw new ResponseException(HttpStatus.BAD_REQUEST, "error.influencer.media.instagram.notpublic");
}

AuthenticationResponse auth = authenticationService.influencerAuthentication(userInfo.getId(), "instagram");
List<OAuthenticationResponse.Page> pages = new ArrayList<OAuthenticationResponse.Page>();
pages.add(new OAuthenticationResponse.Page(userInfo.getId(), userInfo.getFullName(), userInfo.getProfilePicture(), BigInteger.valueOf(userInfo.getCounts().getFollowedBy())));
Expand Down

0 comments on commit c01926e

Please sign in to comment.