Java library for Hydro OAuth2
This library helps people to authorize on Hydrogen APIs. Raindrop, Snowflake etc..
Add below dependency into your pom.xml
<dependency> <groupId>com.github.serkanalgl</groupId> <artifactId>hydro-oauth2-java</artifactId> <version>1.0.0</version></dependency>You can also install manually:
git clone https://github.com/serkanalgl/hydro-oauth2-java.gitcd hydro-oauth2-javamvn 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 environmentclientId (required): Your OAuth id for the Hydro APIclientSecret (required): Your OAuth secret for the Hydro APIToken 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 callstokenType: Always will be bearerexpriesIn: 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 applicationapps: Always will be hydroAuthorization on HYDRO APIs
Should be send as header "Authorization" : "Bearer " + token.getAccessToken() If you have any further question/suggestion/issue, do not hesitate to contact me.
serkanalgl@gmail.com
Copyright (c) 2018, Under MIT licence Serkan Algül. All rights reserved.