socialauth

A minimalist social authentication library for Java

Лицензия

Лицензия

Группа

Группа

me.loki2302
Идентификатор

Идентификатор

socialauth
Последняя версия

Последняя версия

0.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

socialauth
A minimalist social authentication library for Java
Ссылка на сайт

Ссылка на сайт

https://github.com/loki2302/socialauth
Система контроля версий

Система контроля версий

https://github.com/loki2302/socialauth

Скачать socialauth

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/me.loki2302/socialauth/ -->
<dependency>
    <groupId>me.loki2302</groupId>
    <artifactId>socialauth</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/me.loki2302/socialauth/
implementation 'me.loki2302:socialauth:0.0.1'
// https://jarcasting.com/artifacts/me.loki2302/socialauth/
implementation ("me.loki2302:socialauth:0.0.1")
'me.loki2302:socialauth:jar:0.0.1'
<dependency org="me.loki2302" name="socialauth" rev="0.0.1">
  <artifact name="socialauth" type="jar" />
</dependency>
@Grapes(
@Grab(group='me.loki2302', module='socialauth', version='0.0.1')
)
libraryDependencies += "me.loki2302" % "socialauth" % "0.0.1"
[me.loki2302/socialauth "0.0.1"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
org.codehaus.jackson : jackson-mapper-asl jar 1.9.13
org.apache.httpcomponents : httpclient jar 4.3
commons-io : commons-io jar 2.4
org.twitter4j : twitter4j-core jar 3.0.3

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11

Модули Проекта

Данный проект не имеет модулей.

socialauth

Simple social authentication library for Java:

  1. Google OAuth v.2
  2. Facebook OAuth v.2
  3. Twitter OAuth v.1

How to use

Maven

Add these to your pom.xml:

<dependencies>
  <dependency>
    <groupId>me.loki2302</groupId>
    <artifactId>socialauth</artifactId>
    <version>0.0.1</version>
  </dependency>
</dependencies>

Google authentication

Construct Google authentication service client:

GoogleAuthenticationService google = new GoogleAuthenticationService(
  "<YOUR_API_KEY>",
  "<YOUR_API_SECRET>",
  "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
  "http://localhost:8080/googleCallback");

Redirect user to authUri to start authentication process:

String authUri = google.getAuthenticationUri();

Write an authentication callback handler (/googleCallback?code={code}):

...
String accessToken = google.getAccessToken(code);
...

Optional: use accessToken to retrieve user details:

GoogleUserInfo userInfo = google.getUserInfo(accessToken);

Facebook authentication

Construct Facebook authentication service client:

FacebookAuthenticationService facebook = new FacebookAuthenticationService(
  "<YOUR_API_KEY>",
  "<YOUR_API_SECRET>",
  "email",
  "http://localhost:8080/facebookCallback");

Redirect user to authUri to start authentication process:

String authUri = facebook.getAuthenticationUri();

Write an authentication callback handler (/facebookCallback?code={code})

...
String accessToken = facebook.getAccessToken(code);
...

Optional: use accessToken to retrieve user details:

FacebookUserInfo userInfo = facebook.getUserInfo(accessToken);

Twitter authentication

Construct Twitter authentication service client:

TwitterAuthenticationService twitter = new TwitterAuthenticationService(
  "<YOUR_API_KEY>",
  "<YOUR_API_SECRET>",
  "http://localhost:8080/twitterCallback");

Redirect user to authUri to start authentication process:

String authUri = twitter.getAuthenticationUri();

Write an authentication callback handler (/twitterCallback?oauth_token={oauthToken}&oauth_verifier={oauthVerifier}):

...
OAuthToken accessToken = twitter.getAccessToken(oauthToken, oauthVerifier);
...

Optional: use accessToken to retrieve user details:

TwitterUserInfo userInfo = twitter.getUserInfo(accessToken);

Версии библиотеки

Версия
0.0.1