Skip to content

Commit 6405e8b

Browse files
Updated test
Made fixes to test
1 parent a47689c commit 6405e8b

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

scribejava-apis/src/test/java/com/github/scribejava/apis/examples/Box20Example.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
public final class Box20Example {
1717

1818
private static final String NETWORK_NAME = "Box";
19-
private static final String PROTECTED_RESOURCE_URL = "https://app.box.com/files";
19+
private static final String PROTECTED_RESOURCE_URL = "https://app.box.com/profile";
2020

2121
private Box20Example() {
2222
}
@@ -67,11 +67,23 @@ public static void main(String... args) throws IOException {
6767

6868
// Trade the Request Token and Verfier for the Access Token
6969
System.out.println("Trading the Request Token for an Access Token...");
70-
OAuth2AccessToken accessToken = service.getAccessToken(code);
70+
final OAuth2AccessToken accessToken = service.getAccessToken(code);
7171
System.out.println("Got the Access Token!");
7272
System.out.println("(If you're curious, it looks like this: " + accessToken
7373
+ ", 'rawResponse'='" + accessToken.getRawResponse() + "')");
7474

75+
System.out.println();
76+
77+
// Now let's go and ask for a protected resource!
78+
System.out.println("Now we're going to access a protected resource...");
79+
final OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL, service);
80+
service.signRequest(accessToken, request);
81+
final Response response = request.send();
82+
System.out.println("Got it! Lets see what we found...");
83+
System.out.println();
84+
System.out.println(response.getCode());
85+
System.out.println(response.getBody());
86+
7587
System.out.println("Thats it man! Go and build something awesome with ScribeJava! :)");
7688
}
7789

0 commit comments

Comments
 (0)