OAuthService service = null;
switch(authProvider)
{
case ClientUtils.FACEBOOK:
{
service = new ServiceBuilder()
.provider(FacebookApi.class)
.apiKey(ServerUtils.FACEBOOK_APP_ID)
.apiSecret(ServerUtils.FACEBOOK_APP_SECRET)
.callback(ClientUtils.getCallbackUrl())
.build();
break;
}
case ClientUtils.GOOGLE:
{
service = new ServiceBuilder()
.provider(GoogleApi20.class)
.apiKey(ServerUtils.GOOGLE_APP_ID)
.apiSecret(ServerUtils.GOOGLE_APP_SECRET)
.scope(ServerUtils.GOOGLE_SCOPE)
.callback(ClientUtils.getCallbackUrl())
.grantType(OAuthConstants.AUTHORIZATION_CODE)
.build();
break;
}
case ClientUtils.TWITTER:
{
service = new ServiceBuilder()
.provider(TwitterApi.class)
.apiKey(ServerUtils.TWITTER_APP_ID)
.apiSecret(ServerUtils.TWITTER_APP_SECRET)
.callback(ClientUtils.getCallbackUrl())
.build();
break;
}
case ClientUtils.YAHOO:
{
service = new ServiceBuilder()
.provider(YahooApi.class)
.apiKey(ServerUtils.YAHOO_APP_ID)
.apiSecret(ServerUtils.YAHOO_APP_SECRET)
.callback(ClientUtils.getCallbackUrl())
.build();
break;
}
case ClientUtils.LINKEDIN:
{
service = new ServiceBuilder()
.provider(LinkedInApi.class)
.apiKey(ServerUtils.LINKEDIN_APP_ID)
.apiSecret(ServerUtils.LINKEDIN_APP_SECRET)
.callback(ClientUtils.getCallbackUrl())
.build();
break;
}
case ClientUtils.INSTAGRAM:
{
service = new ServiceBuilder()
.provider(InstagramApi.class)
.apiKey(ServerUtils.INSTAGRAM_APP_ID)
.apiSecret(ServerUtils.INSTAGRAM_APP_SECRET)
.grantType(OAuthConstants.AUTHORIZATION_CODE)
.callback(ClientUtils.getCallbackUrl())
.build();
break;
}
case ClientUtils.GITHUB:
{
service = new ServiceBuilder()
.provider(GithubApi.class)
.apiKey(ServerUtils.GITHUB_APP_ID)
.apiSecret(ServerUtils.GITHUB_APP_SECRET)
.callback(ClientUtils.getCallbackUrl())
.build();
break;
}
case ClientUtils.IMGUR:
{
service = new ServiceBuilder()
.provider(ImgUrApi.class)
.apiKey(ServerUtils.IMGUR_APP_ID)
.apiSecret(ServerUtils.IMGUR_APP_SECRET)
.callback(ClientUtils.getCallbackUrl())
.build();
break;
}
case ClientUtils.FLICKR:
{
service = new ServiceBuilder()
.provider(FlickrApi.class)
.apiKey(ServerUtils.FLICKR_APP_ID)
.apiSecret(ServerUtils.FLICKR_APP_SECRET)
.callback(ClientUtils.getCallbackUrl())
.build();
break;
}
case ClientUtils.VIMEO:
{
service = new ServiceBuilder()
.provider(VimeoApi.class)
.apiKey(ServerUtils.VIMEO_APP_ID)
.apiSecret(ServerUtils.VIMEO_APP_SECRET)
.callback(ClientUtils.getCallbackUrl())
.build();
break;
}
case ClientUtils.WINDOWS_LIVE:
{
// a Scope must be specified
service = new ServiceBuilder()
.provider(LiveApi.class)
.apiKey(ServerUtils.WINDOWS_LIVE_APP_ID)
.apiSecret(ServerUtils.WINDOWS_LIVE_APP_SECRET)
.callback(ClientUtils.getCallbackUrl())
.scope("wl.basic")
.build();
break;
}
case ClientUtils.TUMBLR:
{
service = new ServiceBuilder()
.provider(TumblrApi.class)
.apiKey(ServerUtils.TUMBLR_LIVE_APP_ID)
.apiSecret(ServerUtils.TUMBLR_LIVE_APP_SECRET)
.callback(ClientUtils.getCallbackUrl())
.build();
break;
}
case ClientUtils.FOURSQUARE:
{
service = new ServiceBuilder()
.provider(Foursquare2Api.class)
.apiKey(ServerUtils.FOURSQUARE_APP_ID)
.apiSecret(ServerUtils.FOURSQUARE_APP_SECRET)
.callback(ClientUtils.getCallbackUrl())
.build();