Application integration with spring social site

I currently have a website with Spring MVC and Spring Social, so users can log in using Facebook and Twitter.

Now I want my Android client to access my third-party website with Facebook (or Twitter) credentials. As indicated here , this should be possible. But he does not continue to say how to do it. Can anyone help me with this? Just give me some basic outline of how to do this. I'm really stuck here ...

+5
source share
2 answers

I am in the middle of working on a project that should do the same. I implemented Spring Security and Spring Social for the website, and also had to allow iOS and Android applications to connect through social sites.

Here is what you need to do:

  • Embedding device-specific APIs into the development of your application projects. So, implement Facebook, Twitter, or something else as usual on devices. You will perform the actual authentication process there.

  • Implement a custom URL for your social media login apps. For example, http://yousiteapi.com/services/auth/socialSignin . You will need to pass ALL parameters to this api, which is usually written to the implementation of the UserConnection table - providerId, userProviderId, authenticationToken, secret, etc. If the provider does not use one of them, just go to zero or empty var.

  • Inside this controller, you will need to specify both your implementation of the Spring Social SignInAdapter classes and ConnectionSignUp together with your implementation of ConnectionRepository and UserConnectionRepository and basically play the entire registration process. First, you will need to decide which provider is through the provider, if you pass it back, and use the consumerKey provider and consumerSecret to implement the specific ConnectionFactory that you will need. Then use the data you passed to create the ConnectionData object. Using the ConnectionData object, you create the actual Connection object.

  • Now you are replicating the logic of a regular Spring social login: first use the link to UserConnectionRepository and call the findUserIdsWithConnection () method to find out if the user has previously been registered. If not, call the ConnectionSignUp.execute () method to create the user.

  • Finally, you simply call your SignInAdapter.signin () method to sign the user. Do not forget to indicate your answer OK, so that your application finds out that it was successful.

Wow, that sounds like a lot. Actually sounds more than it is. Hope this at least helped point you in the right direction.

+14
source

Can I find out what the rest will need to pass in the subsequent API request in order to recognize the user and find out that this is a trusted application.

0
source

Source: https://habr.com/ru/post/1469062/


All Articles