The Wayback Machine - https://web.archive.org/web/20200914194535/https://github.com/serkanalgl/hydro-oauth2-java
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Java library for Hydro OAuth2

Introduction

This library helps people to authorize on Hydrogen APIs. Raindrop, Snowflake etc..

Dependency

  • unirest-java 1.4.9

Compilation

  • Java 1.8
  • Maven 3

Installation

Recommended

Add below dependency into your pom.xml

<dependency>
    <groupId>com.github.serkanalgl</groupId>
    <artifactId>hydro-oauth2-java</artifactId>
    <version>1.0.0</version>
</dependency>

Manual

You can also install manually:

git clone https://github.com/serkanalgl/hydro-oauth2-java.git
cd hydro-oauth2-java
mvn clean install

Create HydroOAuth2 Instance

  HydroOAuth2 hydroOAuth2 = new HydroOAuth2Builder()
                .environment(Environment.PRODUCTION))
                .setClientId("my client id")
                .setClientSecret("my client secret")
                .build();

HydroOAuth2Builder parameters

  • environment (default: SANDBOX): Environment.SANDBOX | Environment.PRODUCTION to set your environment
  • clientId (required): Your OAuth id for the Hydro API
  • clientSecret (required): Your OAuth secret for the Hydro API

Get Token

  Token token = hydroOAuth2.getToken();
  • automatically refreshes OAuth token.

  • can throw HydroOAuth2Exception: if not authenticated or hydro api call error.

  • Token properties

    • accessToken : OAuth token that will be used for all subsequent API calls
    • tokenType: Always will be bearer
    • expriesIn: When the token expires in seconds and will need to be called again. Default is 86400.
    • scope: The scope your user has been granted in the application
    • apps: Always will be hydro
  • Authorization on HYDRO APIs

    • Should be send as header "Authorization" : "Bearer " + token.getAccessToken()

Contact

If you have any further question/suggestion/issue, do not hesitate to contact me.

serkanalgl@gmail.com

Donate

Ethereum

Copyright

Copyright (c) 2018, Under MIT licence Serkan Algül. All rights reserved.

About

This library helps people to authorize on Hydrogen APIs. Raindrop, Snowflake etc..

Topics

Resources

Packages

No packages published

Languages

You can’t perform that action at this time.