andrupal-oauth Library

A drupal oauth2 client for Android

License

License

Categories

Categories

FST Data Data Formats Serialization
GroupId

GroupId

com.infstory
ArtifactId

ArtifactId

andrupal-oauth
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

aar
Description

Description

andrupal-oauth Library
A drupal oauth2 client for Android
Project URL

Project URL

https://github.com/yongjhih/andrupal-oauth
Source Code Management

Source Code Management

https://github.com/yongjhih/andrupal-oauth

Download andrupal-oauth

How to add to project

<!-- https://jarcasting.com/artifacts/com.infstory/andrupal-oauth/ -->
<dependency>
    <groupId>com.infstory</groupId>
    <artifactId>andrupal-oauth</artifactId>
    <version>1.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.infstory/andrupal-oauth/
implementation 'com.infstory:andrupal-oauth:1.0.0'
// https://jarcasting.com/artifacts/com.infstory/andrupal-oauth/
implementation ("com.infstory:andrupal-oauth:1.0.0")
'com.infstory:andrupal-oauth:aar:1.0.0'
<dependency org="com.infstory" name="andrupal-oauth" rev="1.0.0">
  <artifact name="andrupal-oauth" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.infstory', module='andrupal-oauth', version='1.0.0')
)
libraryDependencies += "com.infstory" % "andrupal-oauth" % "1.0.0"
[com.infstory/andrupal-oauth "1.0.0"]

Dependencies

compile (6)

Group / Artifact Type Version
com.squareup.okhttp : okhttp jar 2.+
com.squareup.retrofit : converter-jackson jar +
com.fasterxml.jackson.core : jackson-core jar 2.4.+
com.fasterxml.jackson.core : jackson-databind jar 2.4.+
com.squareup.retrofit : retrofit jar 1.7.+
com.squareup.okhttp : okhttp-urlconnection jar 2.+

Project Modules

There are no modules declared in this project.

andrupal-oauth

Build Status Stories in Ready Bountysource Maven Central

drupal

A drupal oauth2_server client for android.

oauth

Usage

  • authorize & token with username and password
DrupalOauth2Manager drupalOauth2Manager = new DrupalOauth2Manager.Builder().setEndpoint("https://example.com/oauth2").setClientId("id").setClientSecret("secret").build();

drupalOauth2Manager.getAccessToken("username", "password", new Callback<Credential>() {
    @Override
    public void success(Credential credential, Response response) {
        //credential.access_token;
    }
    @Override
    public void failure(RetrofitError error) {
    }
});
  • authorize & token with cookie
DrupalOauth2Manager drupalOauth2Manager = new DrupalOauth2Manager.Builder().setEndpoint("https://example.com/oauth2").setClientId("id").setClientSecret("secret").build();

drupalOauth2Manager.getAccessToken("cookie", new Callback<Credential>() {
    @Override
    public void success(Credential credential, Response response) {
        //credential.access_token;
    }
    @Override
    public void failure(RetrofitError error) {
    }
});
  • authorize & token with other oauth provider's access token
DrupalOauth2Manager drupalOauth2Manager = new DrupalOauth2Manager.Builder().setEndpoint("https://example.com/oauth2").setClientId("id").setClientSecret("secret").build();

drupalOauth2Manager.getAccessToken(context, DrupalOauth2Manager.FACEBOOK, "fb_access_token", new Callback<Credential>() {
    @Override
    public void success(Credential credential, Response response) {
        //credential.access_token;
    }
    @Override
    public void failure(RetrofitError error) {
    }
});

Installation

build.gradle:

dependencies {
    ...
    compile "com.infstory:andrupal-oauth:+"
}

Misc

Works with drupal/oauth2_server for drupal, and the bonus of other oauth provider with yongjhih/drupal-hybridauth (https://github.com/yongjhih/drupal-hybridauth/commit/268b72a598665b0738e3b06e7b59dcb3bda5b999)

[License] (LICENSE)

The MIT License (MIT)

Copyright (c) 2014 Andrew Chen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Versions

Version
1.0.0