zoho oauth client impl
This commit is contained in:
parent
703995f959
commit
628d10bae9
2 changed files with 33 additions and 6 deletions
|
|
@ -27,10 +27,17 @@ https://www.zoho.com/books/api/v3/oauth/
|
||||||
|
|
||||||
Base API URI= https://accounts.zoho.eu/
|
Base API URI= https://accounts.zoho.eu/
|
||||||
|
|
||||||
## 1. Generating Grant Token
|
## 1. Client Einrichten
|
||||||
|
|
||||||
https://accounts.zoho.com/oauth/v2/auth?scope=ZohoBooks.invoices.CREATE,ZohoBooks.invoices.READ,ZohoBooks.invoices.UPDATE,ZohoBooks.invoices.DELETE&client_id=1000.NLTM2KUEHI696MSLGEIANATVGGX7IN&state=testing&response_type=code&redirect_uri=https://alexander-logistics-dwc.office-workflow.de/
|
https://api-console.zoho.eu/client/1000.NLTM2KUEHI696MSLGEIANATVGGX7IN
|
||||||
|
|
||||||
## 2. Generate Access and Refresh Token
|
## 2. Generating Grant Token
|
||||||
|
|
||||||
|
https://accounts.zoho.com/oauth/v2/auth?scope=ZohoBooks.invoices.CREATE,ZohoBooks.invoices.READ,ZohoBooks.invoices.UPDATE,ZohoBooks.invoices.DELETE&client_id=1000.NLTM2KUEHI696MSLGEIANATVGGX7IN&state=testing&response_type=code&redirect_uri=https://alexander-logistics-dwc.office-workflow.de/api/zoho/grant
|
||||||
|
|
||||||
|
1000.NLTM2KUEHI696MSLGEIANATVGGX7IN
|
||||||
|
ee9ba49f16e77c64abb89cea13542d2326d8d03ce8
|
||||||
|
|
||||||
|
## 3. Generate Access and Refresh Token
|
||||||
|
|
||||||
https://accounts.zoho.com/oauth/v2/token?code=1000.dd7exxxxxxxxxxxxxxxxxxxxxxxx9bb8.b6c0xxxxxxxxxxxxxxxxxxxxxxxxdca4&client_id=1000.NLTM2KUEHI696MSLGEIANATVGGX7IN&client_secret=ee9ba49f16e77c64abb89cea13542d2326d8d03ce8&redirect_uri=http://www.zoho.com/books&grant_type=authorization_code
|
https://accounts.zoho.com/oauth/v2/token?code=1000.dd7exxxxxxxxxxxxxxxxxxxxxxxx9bb8.b6c0xxxxxxxxxxxxxxxxxxxxxxxxdca4&client_id=1000.NLTM2KUEHI696MSLGEIANATVGGX7IN&client_secret=ee9ba49f16e77c64abb89cea13542d2326d8d03ce8&redirect_uri=http://www.zoho.com/books&grant_type=authorization_code
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.ws.rs.GET;
|
import jakarta.ws.rs.GET;
|
||||||
import jakarta.ws.rs.Path;
|
import jakarta.ws.rs.Path;
|
||||||
import jakarta.ws.rs.Produces;
|
import jakarta.ws.rs.Produces;
|
||||||
|
import jakarta.ws.rs.QueryParam;
|
||||||
import jakarta.ws.rs.core.Context;
|
import jakarta.ws.rs.core.Context;
|
||||||
import jakarta.ws.rs.core.MediaType;
|
import jakarta.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
|
@ -84,7 +85,15 @@ public class ZohoOAuthGrantService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test method
|
* Receive Grant Code.
|
||||||
|
*
|
||||||
|
* The expected query params look like this:
|
||||||
|
*
|
||||||
|
* state=testing
|
||||||
|
* code=1000.c27802b99c007ad8db93a5a7291cb15a.8cb60b6a51df13ea627ef3ac7c2e4791
|
||||||
|
* location=eu
|
||||||
|
* accounts-server=https%3A%2F%2Faccounts.zoho.eu
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* @param workflowgroup
|
* @param workflowgroup
|
||||||
* @param task
|
* @param task
|
||||||
|
|
@ -94,14 +103,25 @@ public class ZohoOAuthGrantService {
|
||||||
@GET
|
@GET
|
||||||
@Path("/grant")
|
@Path("/grant")
|
||||||
@Produces({ MediaType.TEXT_HTML })
|
@Produces({ MediaType.TEXT_HTML })
|
||||||
public String getGrantToken()
|
public String getGrantToken(
|
||||||
|
@QueryParam("state") String state,
|
||||||
|
@QueryParam("code") String code,
|
||||||
|
@QueryParam("location") String location,
|
||||||
|
@QueryParam("accounts-server") String accountsServer)
|
||||||
throws QueryException {
|
throws QueryException {
|
||||||
|
|
||||||
logger.info("├── Receive Grant Token from Zoho");
|
logger.info("├── Receive Grant Token from Zoho");
|
||||||
String baseURI = servletRequest.getRequestURL().toString();
|
String baseURI = servletRequest.getRequestURL().toString();
|
||||||
|
|
||||||
logger.info("│ ├── Base URI=" + baseURI);
|
logger.info("│ ├── Base URI=" + baseURI);
|
||||||
|
|
||||||
|
String queryString = servletRequest.getQueryString();
|
||||||
|
logger.info("│ ├── queryString=" + queryString);
|
||||||
|
|
||||||
|
logger.info("│ ├── state=" + state);
|
||||||
|
logger.info("│ ├── code=" + code);
|
||||||
|
logger.info("│ ├── location=" + location);
|
||||||
|
logger.info("│ ├── accounts-server=" + accountsServer);
|
||||||
|
|
||||||
return "Zoho Grant Token received!";
|
return "Zoho Grant Token received!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue