{"_id":"@crmpartners-srl/zcrm-oauth2","_rev":"2-6cd266404c5632e6efd87d9540036533","name":"@crmpartners-srl/zcrm-oauth2","dist-tags":{"latest":"1.4.4"},"versions":{"1.4.0":{"name":"@crmpartners-srl/zcrm-oauth2","description":"CLI to generate access and refresh token for self-client application for Zoho CRM API v2.","keywords":["zoho","crm","oauth2","api","ZohoCRM"],"version":"1.4.0","author":{"name":"Domenico Ruggiano","email":"domenico.ruggiano@crmpartners.it","url":"https://www.linkedin.com/in/domenico-ruggiano/"},"repository":{"type":"git","url":"git+https://github.com/crmpartners/zcrm-oauth2.git"},"bugs":{"url":"https://github.com/crmpartners/zcrm-oauth2/issues"},"license":"MIT","engines":{"node":">=4"},"main":"index.js","bin":{"zcrm-oauth2":"index.js"},"dependencies":{"chalk":"^2.4.1","commander":"^2.15.1","express":"^4.16.3","open":"^8.4.0","request":"^2.85.0"},"scripts":{"start":"node server.js"},"homepage":"https://github.com/crmpartners/zcrm-oauth2#readme","devDependencies":{},"gitHead":"387a0241a8ed3c3d262186b012c9b53ce33301f1","_id":"@crmpartners-srl/zcrm-oauth2@1.4.0","_nodeVersion":"12.22.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-p3gRu4QKwzvJkzv3YMfZ1eCs7VFsajLPVXgHwTpsz6wA2klKrQbBx7BwGP1fc6VZSs1qnP+a85JWgEFRQYYM7w==","shasum":"71bf17a10b97a0016b8df7ca0dc7536d44410cf8","tarball":"https://registry.npmjs.org/@crmpartners-srl/zcrm-oauth2/-/zcrm-oauth2-1.4.0.tgz","fileCount":6,"unpackedSize":18385,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiJfo2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpn1Q/8DmaOSJuQzDxHxM/7Q2hjW3zSGj8x3OpwhmpDdo5mn38N+Y+q\r\nA0K/5OzJmS86KaRx24H24w9iZ6c3GwBYzrT5uX2AhKKfueKqi2noueaZf+9i\r\nllwwWvnyUaszp+Eo5eVMdmWniusqZvuqvddsrLb/tsaTE0Q9GEghKZ47mxho\r\nSYYVr8ADcGKW7f3UZqfOjG2RS0geBX/9YYl9bBFIszmlA6WFHdy/BXeGB+Rs\r\nGNYUrev5Nt0RrsX564lalkV3oUoLdPnyCGl1ZPRJ3omap+/7rDl8hchHumrA\r\nay+phkoTle04Z2QxWcd/kEkFQBg/DmojxZ7GrHhjxkWQr3/bzGccWmnYWZZ1\r\nvCpsYFjAqmMyuY3upNw5BFckAmTZYqB4jBP2dA9P1VGHke2Ad1DODZ4phK9q\r\nDlHiQFilrijvCubmDMBcmjWZQ+ENI+vLL3CO2muGXV/PpBbNGUXwOZigsCro\r\noonGcyppVCHVzm+Nw4dbemDDMShBQ15BU+JWHkN5RHwIQoX0WDCe4D252cQy\r\nrYCIYnf9aFyVG3qM8wpo2sp3/5tTTVl7WuB5ZJx74Ms4tvCkjp7OZcE+auSL\r\nBUGfQCoLXxTZ+XkE8dSVM8oeLggwqDi3faAUVvtweN83aPzrB5tnFUrZ3GA9\r\nH7e3EMBUMvlvcwIFg8ShSs6+1GKO7i7dsAI=\r\n=yjjk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDClCMGzRiwkmzM0gh7+8EfYeVdbH+eBcW+zH10npXZIwIgRn5K5Lxmt7ccoemfn46mJ0tgHSM7TLOwmd+llvIxaEA="}]},"_npmUser":{"name":"giacomo.sardo","email":"giacomo.sardo@crmpartners.it"},"directories":{},"maintainers":[{"name":"giacomo.sardo","email":"giacomo.sardo@crmpartners.it"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/zcrm-oauth2_1.4.0_1646656054837_0.9133752501133645"},"_hasShrinkwrap":false},"1.4.4":{"name":"@crmpartners-srl/zcrm-oauth2","description":"CLI to generate access and refresh token for self-client application for Zoho CRM API v2.","keywords":["zoho","crm","oauth2","api","ZohoCRM"],"version":"1.4.4","author":{"name":"Domenico Ruggiano","email":"domenico.ruggiano@crmpartners.it","url":"https://www.linkedin.com/in/domenico-ruggiano/"},"repository":{"type":"git","url":"git+https://github.com/crmpartners/zcrm-oauth2.git"},"bugs":{"url":"https://github.com/crmpartners/zcrm-oauth2/issues"},"license":"MIT","engines":{"node":">=4"},"main":"index.js","bin":{"zcrm-oauth2":"index.js"},"dependencies":{"chalk":"^2.4.1","commander":"^2.15.1","express":"^4.16.3","open":"^8.4.0","request":"^2.85.0"},"scripts":{"start":"node server.js","test":"echo 'No Test Available'"},"homepage":"https://github.com/crmpartners/zcrm-oauth2#readme","devDependencies":{},"gitHead":"847a9103d59e33957ecb4234ff8f1dc342694e0a","_id":"@crmpartners-srl/zcrm-oauth2@1.4.4","_nodeVersion":"16.14.0","_npmVersion":"8.3.1","dist":{"integrity":"sha512-NiVhqPCfRfIprUUXem4M1d9UVFxNitScsOyUmbLRs86rKjlCU1dbWviHP0+pX/7HrfqsvbQc3U74wmUpgxSFvQ==","shasum":"21c57dd969eb8e64fcf2350035f2b01d923b649a","tarball":"https://registry.npmjs.org/@crmpartners-srl/zcrm-oauth2/-/zcrm-oauth2-1.4.4.tgz","fileCount":7,"unpackedSize":18777,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiJjvrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpUOg//dL/mR04f9gUVIYrKqh7DfeIn5wSqrO0s0WmKtaWq8RYZpWsT\r\n3kK1WbtSzkVZU4N63h05L4Qf2tj77d5/ULyUCW7pycIKb3gG1esVrFatPmb4\r\n+cPncppB8alTRAYVjlbkvsJPuhEVCMechwJtTbAMmrLcGgL7dSOUgBfZBIrA\r\nfIC+DKzKcs6G4P/EvfBCUsNRXTaJ+xXROuIBq7BfJNUMTZHlEdR/FNQS6v5h\r\n/VoNnk7ANdfZ8IOKxwFvi0meWZHw3ZE8TLG0Qto/D9ctPJ/EUXn77Z5NApUz\r\nJ/AJaenLTmotzBAS7WK/HnJD/I0xeOeANd1n6R/VhpWPm++8S/yPTTvznk9k\r\ndldSfV97Jd9ihd+ToGBJzg7fBrzE9AvRimgR0WeNFkKCYc3mAF12oFoMcUxT\r\nwlu3uJh9Zz8dKsvOIQBPM45216Ngec1mUH4wef23ng2bH334JNJS06R/3Alr\r\nFq7zteLiveWKKg8+Oe2mv3mOa5LUDJGJE4lA4QexxSVrF1n386ry/f9sOeIf\r\nwji0PHKHw/ZvayCLp+AujJtjs/EF8+K+xfxkFegPbTEgaqtQ/kkWPcWapFF4\r\nDExGSjxJWIQzxiMZoxAQKb7bV1Pob0/vwhlEDCLIX2vlBmjebUwTUcwgqZiz\r\n8Mlm5zQlcXNToSCYfgbCic7KwQVNZmE9GXI=\r\n=61Fo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDN1uYmX0meL6wlEA/pLsQOXMCK3YX+JCNzOL7yTsnlXAIgaLKzdmpkziRfBDLsNHyhh1QhweGI58EIjji8rBZVgd8="}]},"_npmUser":{"name":"giacomo.sardo","email":"giacomo.sardo@crmpartners.it"},"directories":{},"maintainers":[{"name":"giacomo.sardo","email":"giacomo.sardo@crmpartners.it"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/zcrm-oauth2_1.4.4_1646672875803_0.680898424243757"},"_hasShrinkwrap":false}},"time":{"created":"2022-03-07T12:27:34.790Z","1.4.0":"2022-03-07T12:27:34.983Z","modified":"2022-04-05T01:50:58.542Z","1.4.4":"2022-03-07T17:07:55.909Z"},"maintainers":[{"name":"giacomo.sardo","email":"giacomo.sardo@crmpartners.it"}],"description":"CLI to generate access and refresh token for self-client application for Zoho CRM API v2.","homepage":"https://github.com/crmpartners/zcrm-oauth2#readme","keywords":["zoho","crm","oauth2","api","ZohoCRM"],"repository":{"type":"git","url":"git+https://github.com/crmpartners/zcrm-oauth2.git"},"author":{"name":"Domenico Ruggiano","email":"domenico.ruggiano@crmpartners.it","url":"https://www.linkedin.com/in/domenico-ruggiano/"},"bugs":{"url":"https://github.com/crmpartners/zcrm-oauth2/issues"},"license":"MIT","readme":"# ZCRM OAuth2 [![npm](https://img.shields.io/npm/v/npm.svg?style=flat-square)](https://www.npmjs.com/package/npm) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/crmpartners/zcrm-oauth2/blob/master/LICENSE)\n\n```shell\n$ npm i -g zcrm-oauth2\n```\n\nCLI module built to simplify the generation of the `access token` and `refresh token` for self-client applications using **Zoho CRM API v2**. \n\nThis can be a useful tool if you quickly want to have an access token to test or use the Zoho CRM APIs (using [Postman](https://www.getpostman.com/), for example)\nand you don't want to generate the tokens manually or setting up any of the [Zoho SDKs](https://www.zoho.com/crm/help/api/v2/) environments.\n\nTake a look to [the classic use case](#classic-use-case) for a quick _how to_ example.\n\nOfficial Zoho documentation [here](https://www.zoho.com/crm/help/api/v2/).\n\n## Table of contents\n\n- [Installing / Getting started](#installing--getting-started)\n- [Usage examples](#usage-examples)\n- [Generating the access and refresh tokens](#generating-the-access-and-refresh-tokens)\n- [Generating the access and refresh tokens without having the `grant code`](#generating-the-access-and-refresh-tokens-without-having-the-grant-code)\n- [Refresh access token](#refresh-access-token)\n- [Using `--file` instead of any option](#using---file-instead-of-any-option)\n- [**Classic use case**](#classic-use-case)\n- [Versioning](#versioning)\n- [License](#license)\n\n## Installing / Getting started\n\n```shell\n$ npm install -g zcrm-oauth2\n```\n\nTo see all the CLI options:\n\n```shell\n$ zcrm-oauth2 -h\n``` \n\n### Prerequisites\n\nNode >= 4.0.0 is required.\n\n## Usage examples\n\n```shell\n$ zcrm-oauth2 -h\n\nUsage: zcrm-oauth2 [options]\n\n  Options:\n\n    --id <id>                  * client-id obtained from the connected app.\n    --secret <secret>          * client-secret obtained from the connected app.\n    --redirect <redirect>      * Callback URL that you registered. To generate <grant_token> is required \"localhost\".\n    --code <grant_token>       If not present, will be generated. It requires to redirect to \"localhost\" to make it work.\n    --refresh <refresh_token>  refresh-token used to generate new access tokens.\n    --scope <scopes...>        List of scopes separated by \",\". Default value is \"ZohoCRM.modules.ALL\".\n    -f, --file <file>          File containing options parameters.\n    -l, --location <location>  Zoho API authentication location. Default value is \"eu\".\n    -o, --output <output>      Output file name.\n    -V, --version              output the version number\n    -h, --help                 output usage information\n\n    * required fields.\n```\n\nIf you have already generated the `grant token`, you can pass it using the `--code` option.\nIf no `--code` option is provided, the tool will generate the `grant code` for you.\n\n### Generating the access and refresh tokens\n\nWhen you have the `grant token` you just have to use the options `--code` followed by your `grant token`.\n\n```shell\n$ zcrm-oauth2 --id XXXXX --secret XXXXX --redirect http://your-redirect --code XXXXX\n```\n\nThis will generate your tokens.\n\n### Generating the access and refresh tokens without having the `grant code`\n\nExample usage:\n\n```shell\n$ zcrm-oauth2 --id XXXXX --secret XXXXX --redirect http://localhost:8000/ \n```\n\n> Generating the `grant code` automatically requires to set **http://localhost:[port]/** as redirect URL \nin you application configuration. \n\nFor example:\n\n```shell\n$ zcrm-oauth2 --id XXXXX --secret XXXXX --redirect http://localhost:3333/ \n```\n\nYou can also specify the **scope** of the `grant code` specifying the privileges for the application using \nthe `--scope` option followed by the list of privileges. \n\nThe default value is `ZohoCRM.modules.ALL` that will give you full access to the CRM.\n\nTo obtain access to the _Leads_ and _Accounts_ modules only, for example:\n\n```shell\n$ zcrm-oauth2 --id XXXXX --secret XXXXX --redirect http://localhost:8000/ --scope ZohoCRM.modules.Leads,ZohoCRM.modules.Accounts\n```\n\n### Refresh access token\n\nYou can provide the `--refresh` option followed by the `refresh token` that you generated in the previous step to\ngenerate new access tokens when the current ones are past the expiry time.\n\n```shell\n$ zcrm-oauth2 --id XXXXX --secret XXXXX --redirect http://localhost:8000/ --refresh XXXXX\n``` \n\n### Using `--file` instead of any option\n\nIf you have to set a lot of different options the line you have to type can quickly become pretty long.\n\nFor this reason, you can use the option `-f` or `--file` followed by the name of a **JSON** file containing \nall the options that you should pass as agruments.\n\nFor example, the following line:\n\n```shell\n$ zcrm-oauth2 --id XXXXX --secret XXXXX --redirect http://localhost:2345 --scope ZohoCRM.modules.Leads,ZohoCRM.modules.Accounts --location com\n```\n\ncan be simplified:\n\n```shell\n$ zcrm-oauth2 -f ./auth.json\n```\n\nand the `./auth.json` file should look like this:\n\n```\n{\n    \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n    \"secret\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n    \"redirect\": \"http://localhost:2345\",\n    \"scope\": \"ZohoCRM.modules.Leads,ZohoCRM.modules.Accounts\",\n    \"location\": \"com\"\n}\n```\n\nThis can help you to keep your parameters organized in a more readable way.\n\nThe keys you have to use in the json file are the names of the options without `--`. \n\n> For example, for `--redirect` you use `redirect`, for `--secret` you use `secret`, ...      \n\n### Classic use case\n\nYou want to quickly have access and refresh token for your **self-client** app and you don't want to follow \nthe two/step procedure described [here](https://www.zoho.com/crm/help/api/v2/#oauth-request) to generate the tokens.\n\nIf you want to generate automatically the grant token, you need to run this tool in a machine with a browser.\n\nFollow this steps:\n\n1. Go to <https://accounts.zoho.com/developerconsole> and create your app. Use **http://localhost:8000/** as redirect URL\n![_1](https://user-images.githubusercontent.com/30785662/40118638-c6b709e8-591a-11e8-80f8-0221edfdf768.gif)\n\n2. Copy your _client id_ and _client secret_ and paste it in a JSON file called \"auth.json\"\n![_2](https://user-images.githubusercontent.com/30785662/40118645-c9b70ad0-591a-11e8-87a9-6d2ce68c42e5.gif)\n\n3. Add to the JSON file the additional options you need to run for the specific authentication\n![_3](https://user-images.githubusercontent.com/30785662/40118648-cc002b32-591a-11e8-95b7-8837e2f36a98.gif)\n\n4. Run the tool and get the access and refresh tokens!\n![_4](https://user-images.githubusercontent.com/30785662/40118654-cf351f42-591a-11e8-9676-47aa8d9c5806.gif)\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning.\n\n### Setting up Dev\n\nEverything you need to do is:\n\n```shell\n$ git clone https://github.com/crmpartners/zcrm-oauth2\n$ cd zcrm-oauth2/\n$ npm install\n```\n\nThat's it. You can start working on it!\n\n## License\n\nZCRM OAuth2 is an open source software [licensed as MIT](https://github.com/crmpartners/zcrm-oauth2/blob/master/LICENSE).\n","readmeFilename":"README.md"}