How to connect Facebook, Twitter & Google accounts in Java (Spring MVC) - spring-mvc

I'm going through the features of social auth (http://code.google.com/p/socialauth/) & wondering if this is the best thing for my requirement. Please guide.
My web application currently has it's own login mechanism(native). But I'm planning to do the following:
Login through Facebook(F), Twitter(T) and Google(G) options
After login (either through F,T,G or native login), I want to give user the option of selecting F friends, T followers or G contacts (in a textbox with autosuggest facility)
So my doubt is: (social auth says that "..currently Facebook, Twitter and LinkedIn do not provide email addresses. UPDATE: Hotmail has stopped providing email addresses.")
So although I'll have a list of followers, friends or contacts will I be able to notify them once my user selects and submits his form?
Will it be through F,T or G respectively(through status updates, tweets or email?)
Moreover, I've one more scenario:
E.g. the user has logged in using Facebook. Now I want the user to be able to link her Twitter and Google account too. Can socialauth provide that?
If yes, how would I handle multiple profile objects of the same user?
Please guide or suggest any other library.
My application is in Spring MVC.
Or shall I use Spring Social?

Since your application uses Spring-MVC you should try Spring Social. It would be best for your application.

You can also use socialauth library. It also has spring version to connect with FB, twitter and others provider. Link for the same is as given below:-
http://code.google.com/p/socialauth/

Spring Social is best option for your requirement and in can be easily integrated with

There are 2 proven ways which can be used for this
Using Spring-security-oauth2
Using Spring Social
However, if you are using just Spring Social based on the facebook example, provided on the Spring Website then be mindful of these issues
It doesn't work for more than 1 user
Spring-social doesn't support Google either.
It is also difficult to change the redirect flow unless you override the methods
But the good thing is there are workarounds to fix them and they are quite simple.
Here is how to fix FB one user per application problem
For connecting/authenticating with Google
For Changing the default redirect flow
The Complete tutorial with step by step instructions can be found here
Having explored both oauth2 and Spring Social. I would suggest Spring-social as its lot more simpler and custom built for social logins only.

Related

Woocommerce Membership REST API check if user has a membership plan

I ma developing a mobile app with a wordpress backend that was developed by someone else and the person is unreachable. I have the usual Woocomerce membership plans built on the backend. The website works perfectly fine. The issue is this
I checked the REST API endpoints through 'discovery' and found all the usual endpoints, but my issue is how will i test the if the user has a membership plan via REST API. I have already wasted a lot of time figuring out the solution.
/wc/v3/memberships lists all the endpoints
/wc/v3/memberships/plans/ lists all the plans
when i make a call to all these endpoints, it gives me all the users which have memberships.
My question is how would i know if the current loggedin user has purchased a membership, there is no such specific endpoint to it, plus the docs are not very specific. They are vaugue. Good enough for a beginner but not for a production level.
This is the url which i am referring to, which i got from the "official" Woocomerce Membership website
https://skyverge.github.io/woocommerce-memberships-rest-api-docs/#get-user-memberships
Use this endpoint :
GET http://example.com/wp-json/wc/v3/memberships/members/
Just replace with current user id. you can get current user id through this endpoint :
GET http://example.com/wp-json/wp/v2/users/me

How to get LinkedIn member data using profile URL?

I am trying to build a service to get profile data(Education, Experience, Skills etc.) of a LinkedIn user using profile URL.
I do not want to use any LinkedIn developer APIs.
One of the solution I have come across is using Selenium and BeautifulSoup library where I need to login and parse the html page but LinkedIn can block my IP in such cases.
I want to scale my service to thousands of hits in a month.
What could be the other alternatives to achieve this? Is it possible to do this without login?

Is it possible to integrate google analytics dashboard to our own website?

I want to show google analytics dashboard to my users. It is not possible to give access of "google analytics dashboard" to all users. So I want to integrate it on my own website. Will it be possible to integrate google analytics dashboard on a particular website?
This question gets asked quite a bit. It is important to understand the security model for the API. All Google APIs use OAuth2.0 to authenticate the user. This is designed to make it easy to use the API to access the Users's data on behalf of the user. In contrast you will need to do work to show Your data to your users.
With that said, an example of what you are looking for is the Server side Auth example provided by the Analytics API team.
The simplest answer is to query the API on the server side, with a service account and serve that data as you serve any other data to your users. Read the scenarios in detail, and pick one that best suits your end goals. Understand how the API views the following entities.
A User uses an application.
A Developer develops Application.
An Application has a project id and its associated credentials.
A user authorizes an application to access their data via the API.
You are breaking this paradigm because you are the user and developer from the API's perspective. You want to share your data with people who are not authorized to view it, so you will need to use a service account to access that data and share it directly with your users.
Also remember to add the service account to Analytics View you wish it to access.
Check out EmbeddedAnalytics if you prefer not to get bogged down learning oAuth2, the CoreReporting API, and lastly a charting tool. We simplify the process. All you do is create your chart and embed a snippet of code in your site where you want the chart/dashboard to show.

Verfiy user is who they say they are on an external website

I am developing a website for our GTA Online Crew, basically a gaming community, my issue lies in verifying that they are the user they say they are when they register (For example if there username on social club is GTOFAN01, we want to ensure that person uses the same username on our site when they register).
As we want all website users to have the same names from social club (owned by Rockstar and I have no way to change anything on there end...) to our website to avoid confusion / posers / trolls etc.
I've had a few ideas but they all create a lot of manual work or I am not sure how to implement, but I have narrowed it down...
Let anyone register and then manually send them a confirmation code through social club to the account name they have said they are.
somehow find out who they are currently logged in as on social club, if this matches the name they supplied then let them in.
find someway to send a message to there social club message box
2 is by far the best, but I can figure out a way to achieve it... I cannot read cookies or session variables from another domain.
Any ideas?
There are several different ways of achieving "federated identity". I would recommend taking a look at OAuth and OpenId. Asp.net Identity has OAuth integration.
See also:
OpenID vs. OAuth
What's the difference between OpenID and OAuth?
The way I ended up going was generating a random qoute for the user to post on the social club (checking it didn't exist first), as the social club feed is public I can then check to see if the qoute was posted and by whom, if this matches who they told us they were then there registration is accepted.
Obviously this is not the greatest solution, but it works and as I've stated I have no control over the social club nor do they offer any way to authenticate a user.
The other befit to this method is it encourages use of the feed which we also wanted to do.

Facebook API Auto accept friend request

I've created a web application that uses the Facebook API.
I would like to implement/create a method which is able to auto accept friend request of my own Facebook account.
Is this even possible and how to implement it in C#/ ASP.NET MVC?
Thank you in advance!
*I alreay read the Facebook Developers documentation https://developers.facebook.com/docs/howtos/requests/ but haven't been able to solve my 'problem'.
There is no API to send or approve friend requests.
There is the Friends Dialog but it sounds like you want this to work without user interaction which is impossible.
If you find some way to do this, you should report it via Facebook's whitehat bug bounty program, as it indicates a bug on Facebook's side.

Resources