OAUTH TWITTER

How to implement OAuth Social Login (Single Sign-On)Using Twitter & Spring Boot (Java)— Part 2

Hello👋, Its Rohan Kadam😊

Hello All, Hope you are well. Today we are going to implement OAuth Login using Twitter also called Social Login. Also, remember that Twitter doesn’t support OAuth2 flow its support OAuth 1 follow for Social Login

How to implement OAuth Social Login Using Twitter & Spring Boot (Java) — Part 2

Step 1:- Create a Spring Boot Project using Spring initializer

Step 2:- Add the following dependencies in your project pom.xml

<!-- https://mvnrepository.com/artifact/org.springframework.social/spring-social-twitter -->
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-twitter</artifactId>
<version>1.1.2.RELEASE</version>
</dependency>

Step 3:- Generate Twitter Credetinals from Twitter Developer Portal

Step 4:- Create Twitter Controller with Endpoints

Controller Class For Twitter Login

Note:-

  1. By calling the endpoint ( /oauth2/authorize/normal/twitter ), a Twitter connection factory is created using the client Key and client secret key. Since Twitter follows OAuth1 follow we will create OAuth1Operations.
  2. Using OAuth1Operations will we fetch request tokens using the following endpoint provided by Twitter.
https://api.twitter.com/oauth/request_token

3. Using request token we will generate Authorize Url

4. On Successful authorization it will redirect ( /oauth2/callback/twitter )

5. Will follow 1 to 2 again on redirect and generate a request token

6. On Using Request Token it will generate Token.

7. Using Twitter Template will generate Twitter Profile.

8. Twitter Profile will return a Twitter User object.

Thank You Viewers

--

--

--

Full Stack Developer, Mumbai, India. Personal Website https://kadamrohan.com For Collab DM me @rohankadam25 on Twitter (Open for Work)

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What’s the Best Way to Learn a Tech?

Technology in work.

The New York Times API in Django

6 Things to Share Before Outsourcing Your Rails App

System Administrator’s DOs and DON’Ts: interview with Kenneth Hess

A Collection of the Best JavaScript Array Tricks

mulesoft online training in India |mule 4 online training | OnlineITGguru

Super Simple Serverless eCommerce

Learn Data Structures and Algorithms

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rohan Ravindra Kadam

Rohan Ravindra Kadam

Full Stack Developer, Mumbai, India. Personal Website https://kadamrohan.com For Collab DM me @rohankadam25 on Twitter (Open for Work)

More from Medium

Build Your First Spring Boot Project!

What is Stack Data Structure? Explained with code in Java.

VERY Basic Differences Between Java and JavaScript-Arrays

Writing your spring security expression language annotation — PART 3