Added authorization URL to the Apis
This commit is contained in:
1 parent
c12da16a38
commit
5ac849313d
16 files changed
+121
-20
No files matched your search
@@ -9,7 +9,6 @@ import org.scribe.oauth.*;
|
||||
|
||||
public class FoursquareExample
|
||||
{
|
||||
private static final String AUTHORIZE_URL = "http://foursquare.com/oauth/authorize?oauth_token=";
|
||||
private static final String PROTECTED_RESOURCE_URL = "http://api.foursquare.com/v1/user";
|
||||
|
||||
public static void main(String[] args)
|
||||
@@ -31,7 +30,7 @@ public class FoursquareExample
|
||||
System.out.println();
|
||||
|
||||
System.out.println("Now go and authorize Scribe here:");
|
||||
System.out.println(AUTHORIZE_URL + requestToken.getToken());
|
||||
System.out.println(service.getAuthorizationUrl(requestToken));
|
||||
System.out.println("And paste the verifier here");
|
||||
System.out.print(">>");
|
||||
Verifier verifier = new Verifier(in.nextLine());
|
||||
|
||||
@@ -9,18 +9,17 @@ import org.scribe.oauth.*;
|
||||
|
||||
public class LinkedInExample
|
||||
{
|
||||
private static final String AUTHORIZE_URL = "https://api.linkedin.com/uas/oauth/authorize?oauth_token=";
|
||||
private static final String PROTECTED_RESOURCE_URL = "http://api.linkedin.com/v1/people/~/connections:(id,last-name)";
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
OAuthService service = new ServiceBuilder()
|
||||
.provider(LinkedInApi.class)
|
||||
.apiKey("CiEgwWDkA5BFpNrc0RfGyVuSlOh4tig5kOTZ9q97qcXNrFl7zqk-Ts7DqRGaKDCV")
|
||||
.apiSecret("dhho4dfoCmiQXrkw4yslork5XWLFnPSuMR-8gscPVjY4jqFFHPYWJKgpFl4uLTM6")
|
||||
.build();
|
||||
|
||||
.provider(LinkedInApi.class)
|
||||
.apiKey("CiEgwWDkA5BFpNrc0RfGyVuSlOh4tig5kOTZ9q97qcXNrFl7zqk-Ts7DqRGaKDCV")
|
||||
.apiSecret("dhho4dfoCmiQXrkw4yslork5XWLFnPSuMR-8gscPVjY4jqFFHPYWJKgpFl4uLTM6")
|
||||
.build();
|
||||
Scanner in = new Scanner(System.in);
|
||||
|
||||
System.out.println("=== LinkedIn's OAuth Workflow ===");
|
||||
System.out.println();
|
||||
|
||||
@@ -31,7 +30,7 @@ public class LinkedInExample
|
||||
System.out.println();
|
||||
|
||||
System.out.println("Now go and authorize Scribe here:");
|
||||
System.out.println(AUTHORIZE_URL + requestToken.getToken());
|
||||
System.out.println(service.getAuthorizationUrl(requestToken));
|
||||
System.out.println("And paste the verifier here");
|
||||
System.out.print(">>");
|
||||
Verifier verifier = new Verifier(in.nextLine());
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.scribe.oauth.*;
|
||||
|
||||
public class TwitterExample
|
||||
{
|
||||
private static final String AUTHORIZE_URL = "https://api.twitter.com/oauth/authorize?oauth_token=";
|
||||
private static final String PROTECTED_RESOURCE_URL = "http://api.twitter.com/1/account/verify_credentials.xml";
|
||||
|
||||
public static void main(String[] args)
|
||||
@@ -31,7 +30,7 @@ public class TwitterExample
|
||||
System.out.println();
|
||||
|
||||
System.out.println("Now go and authorize Scribe here:");
|
||||
System.out.println(AUTHORIZE_URL + requestToken.getToken());
|
||||
System.out.println(service.getAuthorizationUrl(requestToken));
|
||||
System.out.println("And paste the verifier here");
|
||||
System.out.print(">>");
|
||||
Verifier verifier = new Verifier(in.nextLine());
|
||||
|
||||
@@ -9,20 +9,18 @@ import org.scribe.oauth.*;
|
||||
|
||||
public class YahooExample
|
||||
{
|
||||
private static final String NETWORK_NAME = "Yahoo";
|
||||
private static final String AUTHORIZE_URL = "https://api.login.yahoo.com/oauth/v2/request_auth?oauth_token=";
|
||||
private static final String PROTECTED_RESOURCE_URL = "http://social.yahooapis.com/v1/user/A6ROU63MXWDCW3Y5MGCYWVHDJI/profile/status?format=json";
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
OAuthService service = new ServiceBuilder()
|
||||
.provider(YahooApi.class)
|
||||
.apiKey("dj0yJmk9TXZDWVpNVVdGaVFmJmQ9WVdrOWMweHZXbkZLTkhVbWNHbzlNVEl5TWprd05qUTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0wMw--")
|
||||
.apiSecret("262be559f92a2be20c4c039419018f2b48cdfce9")
|
||||
.build();
|
||||
.provider(YahooApi.class)
|
||||
.apiKey("dj0yJmk9TXZDWVpNVVdGaVFmJmQ9WVdrOWMweHZXbkZLTkhVbWNHbzlNVEl5TWprd05qUTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0wMw--")
|
||||
.apiSecret("262be559f92a2be20c4c039419018f2b48cdfce9")
|
||||
.build();
|
||||
Scanner in = new Scanner(System.in);
|
||||
|
||||
System.out.println("=== " + NETWORK_NAME + "'s OAuth Workflow ===");
|
||||
System.out.println("=== Yahoo's OAuth Workflow ===");
|
||||
System.out.println();
|
||||
|
||||
// Obtain the Request Token
|
||||
@@ -32,7 +30,7 @@ public class YahooExample
|
||||
System.out.println();
|
||||
|
||||
System.out.println("Now go and authorize Scribe here:");
|
||||
System.out.println(AUTHORIZE_URL + requestToken.getToken());
|
||||
System.out.println(service.getAuthorizationUrl(requestToken));
|
||||
System.out.println("And paste the verifier here");
|
||||
System.out.print(">>");
|
||||
Verifier verifier = new Verifier(in.nextLine());
|
||||
|
||||
Reference in new issue
Block a user