@Test public void testMember() throws InterruptedException, JSONException { // The member must be unlocked to begin the test String accessToken = getAccessTokenWithScopePath( ScopePathType.READ_LIMITED, lockedClientId, lockedClientSecret, lockedClientRedirectUri); ClientResponse getAllResponse = memberV2ApiClient.getEmails(user1OrcidId, accessToken); assertNotNull(getAllResponse); Emails emails = getAllResponse.getEntity(Emails.class); assertNotNull(emails); assertNotNull(emails.getEmails()); assertFalse(emails.getEmails().isEmpty()); // Lock and try to get authorization code adminLockAccount(adminUserName, adminPassword, memberId); lookForErrorsOnAuthorizationCodePage( lockedClientId, ScopePathType.READ_LIMITED.value(), lockedClientRedirectUri); // Try to use access token while the client is locked getAllResponse = memberV2ApiClient.getEmails(user1OrcidId, accessToken); assertNotNull(getAllResponse); // unlock to finish adminUnlockAccount(adminUserName, adminPassword, memberId); }
public String getAccessToken(String clientId, String clientSecret, String redirectUri) throws InterruptedException, JSONException { if (accessTokens.containsKey(clientId)) { return accessTokens.get(clientId); } String accessToken = super.getAccessToken( ScopePathType.PERSON_UPDATE.value() + " " + ScopePathType.READ_LIMITED.value(), clientId, clientSecret, redirectUri); accessTokens.put(clientId, accessToken); return accessToken; }