{"_id":"@boateo6/discord-oauth2","_rev":"7-4d852cb386dcca688bfcfe9c46b4c61b","name":"@boateo6/discord-oauth2","dist-tags":{"latest":"1.3.3"},"versions":{"1.0.0":{"name":"@boateo6/discord-oauth2","version":"1.0.0","keywords":["Discord-OAuth2","Easy-Discord-Oauth2","Discord"],"author":{"name":"boateo6"},"license":"ISC","_id":"@boateo6/discord-oauth2@1.0.0","maintainers":[{"name":"boateo6","email":"boateo6Business@gmail.com"}],"dist":{"shasum":"bafaf7d50eb0cd4d0ff1b4efb8474ab7ef9a9892","tarball":"https://registry.npmjs.org/@boateo6/discord-oauth2/-/discord-oauth2-1.0.0.tgz","fileCount":3,"integrity":"sha512-H4rVeVtoYynAHfARJrg6iPyzSVsx5ocVYWzrP4DdVEdaIdpywg5jnpGQaKiTiBENkNMESIGOURetBcI4Oiy+AA==","signatures":[{"sig":"MEUCIGlbWH8+MumHnpkeSqAVFJVSw+ia6MxYh1BjTHvygnd2AiEA5LGno815mtavFkqt/6El3L4puK4EVqY5K4ToM11Md00=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10269},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"boateo6","email":"boateo6Business@gmail.com"},"_npmVersion":"9.6.6","description":"An easy way for Discord OAuth2","directories":{},"_nodeVersion":"20.2.0","dependencies":{"url":"^0.11.3","axios":"^1.6.5","dotenv":"^16.3.1","express":"^4.18.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/discord-oauth2_1.0.0_1705564351820_0.87266291593427","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@boateo6/discord-oauth2","version":"1.0.1","keywords":["Discord-OAuth2","Easy-Discord-Oauth2","Discord"],"author":{"name":"boateo6"},"license":"ISC","_id":"@boateo6/discord-oauth2@1.0.1","maintainers":[{"name":"boateo6","email":"boateo6Business@gmail.com"}],"dist":{"shasum":"efaff4c1a131fb288c58670e598ca90ee18a6640","tarball":"https://registry.npmjs.org/@boateo6/discord-oauth2/-/discord-oauth2-1.0.1.tgz","fileCount":3,"integrity":"sha512-Dhwu+y4n00wTZkNr5VgrXLL+qnnT/hyVb4/vH2vpGFHM8qDd8x4n4kP+WlevMuG4gk4GVPANbYh8mfkeK7SHpg==","signatures":[{"sig":"MEUCIH+P0FGpWtP1IgZC5cCmi9ESbg1JjYF1Lbf8/kVVPYIdAiEAh8MD8KqyBp0AZXqoBYqrc4CT07ALLe7Hbquu7rOV6vs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10229},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"boateo6","email":"boateo6Business@gmail.com"},"_npmVersion":"9.6.6","description":"An easy way for Discord OAuth2","directories":{},"_nodeVersion":"20.2.0","dependencies":{"url":"^0.11.3","axios":"^1.6.5","dotenv":"^16.3.1","express":"^4.18.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/discord-oauth2_1.0.1_1705564599723_0.7821025197068123","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"@boateo6/discord-oauth2","version":"1.1.1","keywords":["Discord-OAuth2","Easy-Discord-Oauth2","Discord"],"author":{"name":"boateo6"},"license":"ISC","_id":"@boateo6/discord-oauth2@1.1.1","maintainers":[{"name":"boateo6","email":"boateo6Business@gmail.com"}],"dist":{"shasum":"11a958cd4779f57372af747bad8471b74b49220e","tarball":"https://registry.npmjs.org/@boateo6/discord-oauth2/-/discord-oauth2-1.1.1.tgz","fileCount":3,"integrity":"sha512-1YRttXA3fHXXyWQDM+TC/IaXb4CyqFgq0IwoI3CmnJkZeaZSiDXl93i3RCXhZLxrxh/zI0Qo46PUNRX0NWCuAg==","signatures":[{"sig":"MEUCIQDml7Ng7LQc7u9omxH05O4rL1QE2Tc0rhAl9QB8mz6hgAIgMIrQNgQb1M92lDeBvoOZcoUH3TV+lBRh/S/3YF5Q5/Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11101},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"boateo6","email":"boateo6Business@gmail.com"},"_npmVersion":"9.6.6","description":"An easy way for Discord OAuth2","directories":{},"_nodeVersion":"20.2.0","dependencies":{"url":"^0.11.3","axios":"^1.6.5","dotenv":"^16.3.1","express":"^4.18.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/discord-oauth2_1.1.1_1705573621400_0.19335329786127087","host":"s3://npm-registry-packages"}},"1.1.2":{"name":"@boateo6/discord-oauth2","version":"1.1.2","keywords":["Discord-OAuth2","Easy-Discord-Oauth2","Discord"],"author":{"name":"boateo6"},"license":"ISC","_id":"@boateo6/discord-oauth2@1.1.2","maintainers":[{"name":"boateo6","email":"boateo6Business@gmail.com"}],"dist":{"shasum":"3c9f37c8d23ff4d4f50084d5127c391957d8dbf5","tarball":"https://registry.npmjs.org/@boateo6/discord-oauth2/-/discord-oauth2-1.1.2.tgz","fileCount":3,"integrity":"sha512-x0vaGAqVXiA+iTP2NBK0NkNuqPtkHuS3Kit9DbLD4goL3MDN5Nn2FMCKo/pf14QFPRkacpACaei+pPGvPZ6rWg==","signatures":[{"sig":"MEUCIQCGVng2+86pSL/LnDUzC4BoNl4pcbGJ6rvaIfwKRU2DZwIgZ4lecWyiH+CF64b3e94XJAJMpyA5UWiiAisvUT87KKU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11131},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"boateo6","email":"boateo6Business@gmail.com"},"_npmVersion":"9.6.6","description":"An easy way for Discord OAuth2","directories":{},"_nodeVersion":"20.2.0","dependencies":{"url":"^0.11.3","axios":"^1.6.5","dotenv":"^16.3.1","express":"^4.18.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/discord-oauth2_1.1.2_1705684007731_0.4910362269618087","host":"s3://npm-registry-packages"}},"1.2.2":{"name":"@boateo6/discord-oauth2","version":"1.2.2","keywords":["Discord-OAuth2","Easy-Discord-Oauth2","Discord"],"author":{"name":"boateo6"},"license":"ISC","_id":"@boateo6/discord-oauth2@1.2.2","maintainers":[{"name":"boateo6","email":"boateo6Business@gmail.com"}],"dist":{"shasum":"6ff005e26e195e03a00b52e53fc9490dbaf5b4e6","tarball":"https://registry.npmjs.org/@boateo6/discord-oauth2/-/discord-oauth2-1.2.2.tgz","fileCount":3,"integrity":"sha512-8yOIXxPglGEexg7DTQjot2N90B58uZRi5Bv9DfnlMCsiGxihHfJMk21/1onVtXejH0/zNwiLDU8rXlSHQR8mZQ==","signatures":[{"sig":"MEUCIDCx0T/cfB0X+25ihUD7qsfk2gDSV4SLJPABQCb48/EKAiEAwf6YrAG5uOLIhJAIuiRdV7PuImPMB4UF7cja9k1u5uk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11223},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"boateo6","email":"boateo6Business@gmail.com"},"_npmVersion":"9.6.6","description":"An easy way for Discord OAuth2","directories":{},"_nodeVersion":"20.2.0","dependencies":{"url":"^0.11.3","axios":"^1.6.5","dotenv":"^16.3.1","express":"^4.18.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/discord-oauth2_1.2.2_1705690901461_0.22984989148347656","host":"s3://npm-registry-packages"}},"1.3.2":{"name":"@boateo6/discord-oauth2","version":"1.3.2","keywords":["Discord-OAuth2","Easy-Discord-Oauth2","Discord"],"author":{"name":"boateo6"},"license":"ISC","_id":"@boateo6/discord-oauth2@1.3.2","maintainers":[{"name":"boateo6","email":"boateo6Business@gmail.com"}],"dist":{"shasum":"1fb1c2fec5da4823c25f3007884fa5a0d4fe9682","tarball":"https://registry.npmjs.org/@boateo6/discord-oauth2/-/discord-oauth2-1.3.2.tgz","fileCount":3,"integrity":"sha512-dPAqRd+LilVnTfntNoXr/Fx2MbXQS/XzDmgjhgeImTSYOTeMfidZwBBfOGLFg+jtIRIyFh+gE6EiSJ5secMiMw==","signatures":[{"sig":"MEUCIFjeSpTTPmwOZc+cmwTvmHtg5jAulUe7cYJExqAERLveAiEAtxtkQiXxpAkpz6lXIvtxAb1+EqPxZ/r290y1zGz3aqA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":6138},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"boateo6","email":"boateo6Business@gmail.com"},"_npmVersion":"9.6.6","description":"An easy way for Discord OAuth2","directories":{},"_nodeVersion":"20.2.0","dependencies":{"axios":"^1.8.1","express":"^4.21.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/discord-oauth2_1.3.2_1741243622117_0.6035463902505043","host":"s3://npm-registry-packages-npm-production"}},"1.3.3":{"name":"@boateo6/discord-oauth2","version":"1.3.3","description":"An easy way for Discord OAuth2","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["Discord-OAuth2","Easy-Discord-Oauth2","Discord"],"author":{"name":"boateo6"},"license":"ISC","dependencies":{"axios":"^1.8.1","express":"^4.21.2"},"_id":"@boateo6/discord-oauth2@1.3.3","_nodeVersion":"20.2.0","_npmVersion":"9.6.6","dist":{"integrity":"sha512-hhS2BtZrNCcjuIelcE5YyTPHIrxm3o4TIJfm42xwNcj8ux9jGuDiE8JICQpKfH0rjO+83FKl8RsK/8TasmLDAw==","shasum":"106e7695cebe83f6d83e99ec3ea930f9ad664a7c","tarball":"https://registry.npmjs.org/@boateo6/discord-oauth2/-/discord-oauth2-1.3.3.tgz","fileCount":3,"unpackedSize":6653,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDBUx5XSiu557WQaxgZVkMczu9JH0Qr70CDxXup9QWdpwIgYoOOLrV6njqM+3Ghlpx25KPdwfND5ckaZoQhEnGdzQE="}]},"_npmUser":{"name":"boateo6","email":"boateo6Business@gmail.com"},"directories":{},"maintainers":[{"name":"boateo6","email":"boateo6Business@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/discord-oauth2_1.3.3_1741244070746_0.5699830808427171"},"_hasShrinkwrap":false}},"time":{"created":"2024-01-18T07:52:31.721Z","modified":"2025-03-06T06:54:31.076Z","1.0.0":"2024-01-18T07:52:31.966Z","1.0.1":"2024-01-18T07:56:39.862Z","1.1.1":"2024-01-18T10:27:01.551Z","1.1.2":"2024-01-19T17:06:47.971Z","1.2.2":"2024-01-19T19:01:41.631Z","1.3.2":"2025-03-06T06:47:02.277Z","1.3.3":"2025-03-06T06:54:30.923Z"},"author":{"name":"boateo6"},"license":"ISC","keywords":["Discord-OAuth2","Easy-Discord-Oauth2","Discord"],"description":"An easy way for Discord OAuth2","maintainers":[{"name":"boateo6","email":"boateo6Business@gmail.com"}],"readme":"# Table of Contents\r\n- Installation\r\n- Usage\r\n- Methods\r\n- Example\r\n- License\r\n- Author\r\n\r\n## Installation\r\nTo install the package, run the following command in your terminal:\r\n\r\n```bash\r\nnpm install @boateo6/discord-oauth2\r\n```\r\n\r\n## Usage\r\nThis package provides a simple way to authenticate with Discord using OAuth2. Here's an example of how to use it:\r\n\r\n### Creating an Instance\r\nTo use the package, you need to create an instance of the `DiscordOAuth2` class, passing in your client ID, client secret, and redirect URI:\r\n\r\n```javascript\r\nconst { DiscordOAuth2 } = require(\"@boateo6/discord-oauth2\");\r\nconst oauth = new DiscordOAuth2({\r\n  client_id: \"YOUR_CLIENT_ID\",\r\n  client_secret: \"YOUR_CLIENT_SECRET\",\r\n  redirect: \"http://localhost:3000/api/auth/callback\",\r\n});\r\n```\r\n\r\n### Handling the OAuth2 Flow\r\nTo handle the OAuth2 flow, you need to create an Express route that will handle the redirect from Discord:\r\n\r\n```javascript\r\nconst express = require(\"express\");\r\nconst app = express();\r\n\r\napp.get(\"/api/auth/callback\", (req, res) => {\r\n  oauth.process(req, res, (data) => {\r\n    console.log(data);\r\n  });\r\n});\r\n```\r\n\r\nIn this example, the `oauth.process` method is called with the Express request and response objects, as well as a callback function that will be called with the authentication data and user data.\r\n\r\n### Getting User Information\r\nTo get information about the authenticated user, you can use the `getUserInfo` method:\r\n\r\n```javascript\r\noauth.getUserInfo(access_token, (userInfo) => {\r\n  console.log(userInfo);\r\n});\r\n```\r\n\r\nThis method takes the access token returned by the `process` method (or if you already have an access token) and a callback function that will be called with the user information.\r\n\r\n## Methods\r\n\r\n### `new DiscordOAuth2(options)`\r\n- `options.client_id`: Your Discord client ID.\r\n- `options.client_secret`: Your Discord client secret.\r\n- `options.redirect`: The redirect URI for the OAuth2 flow.\r\n\r\n### `oauth.process(req, res, callback)`\r\n- `req`: The Express request object.\r\n- `res`: The Express response object.\r\n- `callback`: A callback function that will be called with the authentication data.\r\n\r\nThe callback function will be called with an object containing the following properties:\r\n- `access_token`: The access token for the authenticated user.\r\n- `refresh_token`: The refresh token for the authenticated user.\r\n- `user_info`: An object containing information about the authenticated user.\r\n\r\n### `oauth.getUserInfo(access_token, callback)`\r\n- `access_token`: The access token for the authenticated user.\r\n- `callback`: A callback function that will be called with the user information.\r\n\r\nThe callback function will be called with an object containing information about the authenticated user.\r\n\r\n## License\r\nISC\r\n\r\n## Author\r\nboateo6\r\n\r\n","readmeFilename":"README.md"}