{"_id":"@cambridge-pte/adonis5-ally-okta","_rev":"5-107846d073a7a5d1dfb586f88d118ebb","name":"@cambridge-pte/adonis5-ally-okta","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@cambridge-pte/adonis5-ally-okta","version":"1.0.0","keywords":["adonisjs","adonis-ally"],"author":{"name":"Russel Herrera"},"license":"MIT","_id":"@cambridge-pte/adonis5-ally-okta@1.0.0","maintainers":[{"name":"rherreracup","email":"russel.herrera@cambridge.org"},{"name":"moris00","email":"moris.mascarinas@cambridge.org"},{"name":"jsunico-cupa","email":"renzo.sunico@cambridge.org"}],"homepage":"https://github.com/cambridge-pte/adonis5-ally-okta#readme","bugs":{"url":"https://github.com/cambridge-pte/adonis5-ally-okta/issues"},"dist":{"shasum":"342f3d7812e2386bcad410f59814ffb8787149dd","tarball":"https://registry.npmjs.org/@cambridge-pte/adonis5-ally-okta/-/adonis5-ally-okta-1.0.0.tgz","fileCount":9,"integrity":"sha512-CmPxuZfPV0kCVX8gOXdciIuS+SHiOYU9blf6M29UukxdcEyYrtNc7VVJI6lrKaQPNUa3v3TCM/cpr/b5PoIY7w==","signatures":[{"sig":"MEYCIQDCcP8yFXHzEPR8yXd8aV5Z6F/fsO28+Hah1qTfBJUGjAIhAMbmQqD6LiEB+aGcVVZd3IImU5uW04J5sf114yQHY/TM","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25293},"main":"build/providers/index.js","gitHead":"01f768ae09b904e8d8c3c7e434d11abfceb5693e","scripts":{"lint":"eslint . --ext=.ts","build":"npm run compile && npm run copyfiles","clean":"del build","format":"prettier --write .","compile":"npm run lint && npm run clean && tsc","version":"npm run build","copyfiles":"copyfiles \"instructions.md\" build","prepublishOnly":"npm run build"},"_npmUser":{"name":"rherreracup","email":"russel.herrera@cambridge.org"},"adonisjs":{"env":{"OKTA_DRIVER_SCOPES":"","OKTA_DRIVER_CLIENT_ID":"","OKTA_DRIVER_TOKEN_URL":"","OKTA_DRIVER_AUTHORIZE_URL":"","OKTA_DRIVER_CLIENT_SECRET":"","OKTA_DRIVER_RESPONSE_TYPE":"","OKTA_DRIVER_USER_INFO_URL":""},"types":"@cambridge-pte/adonis5-ally-okta","providers":["@cambridge-pte/adonis5-ally-okta"],"instructionsMd":"./build/instructions.md"},"repository":{"url":"git+https://github.com/cambridge-pte/adonis5-ally-okta.git","type":"git"},"_npmVersion":"6.14.7","description":"Custom adonisjs/ally provider for Okta.","directories":{},"_nodeVersion":"16.15.1","dependencies":{"node-fetch":"^3.3.2"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^7.28.0","del-cli":"^3.0.1","prettier":"^2.3.1","copyfiles":"^2.4.1","typescript":"^4.3.2","@types/node":"^15.14.9","@adonisjs/ally":"^4.0.0","@adonisjs/core":"^5.1.8","eslint-plugin-adonis":"^1.3.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0"},"peerDependencies":{"@adonisjs/ally":"^4.0.0","@adonisjs/core":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/adonis5-ally-okta_1.0.0_1691651033188_0.3884606661735377","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@cambridge-pte/adonis5-ally-okta","version":"1.0.1","keywords":["adonisjs","adonis-ally"],"author":{"name":"Russel Herrera"},"license":"MIT","_id":"@cambridge-pte/adonis5-ally-okta@1.0.1","maintainers":[{"name":"rherreracup","email":"russel.herrera@cambridge.org"},{"name":"moris00","email":"moris.mascarinas@cambridge.org"},{"name":"jsunico-cupa","email":"renzo.sunico@cambridge.org"}],"homepage":"https://github.com/cambridge-pte/adonis5-ally-okta#readme","bugs":{"url":"https://github.com/cambridge-pte/adonis5-ally-okta/issues"},"dist":{"shasum":"a501aa6453e86c57e4f7e3368efe831187a96c2b","tarball":"https://registry.npmjs.org/@cambridge-pte/adonis5-ally-okta/-/adonis5-ally-okta-1.0.1.tgz","fileCount":9,"integrity":"sha512-1bkoJxujfPgmM9MJHowLlNcaT5jodzZmU07xdUsB3TOb1SUFZO4dEGF1Uhvzydb8Wi5Kiyitlcd4Wqcq1BqN+g==","signatures":[{"sig":"MEUCIARJD8+fiWAdOr1XfF3UaT/YGXItZGMfRyNYEWFsieY5AiEAyFeZQcvtGi4vDb/+a47qtfqB+jrHfS4UebH0OLG3Zjs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25531},"main":"build/providers/index.js","gitHead":"4752b54e51325e44e18bacd4ba04d1c857c4a5c2","scripts":{"lint":"eslint . --ext=.ts","build":"npm run compile && npm run copyfiles","clean":"del build","format":"prettier --write .","compile":"npm run lint && npm run clean && tsc","version":"npm run build","copyfiles":"copyfiles \"instructions.md\" build","prepublishOnly":"npm run build"},"_npmUser":{"name":"rherreracup","email":"russel.herrera@cambridge.org"},"adonisjs":{"env":{"OKTA_DRIVER_SCOPES":"","OKTA_DRIVER_CLIENT_ID":"","OKTA_DRIVER_TOKEN_URL":"","OKTA_DRIVER_AUTHORIZE_URL":"","OKTA_DRIVER_CLIENT_SECRET":"","OKTA_DRIVER_RESPONSE_TYPE":"","OKTA_DRIVER_USER_INFO_URL":""},"types":"@cambridge-pte/adonis5-ally-okta","providers":["@cambridge-pte/adonis5-ally-okta"],"instructionsMd":"./build/instructions.md"},"repository":{"url":"git+https://github.com/cambridge-pte/adonis5-ally-okta.git","type":"git"},"_npmVersion":"6.14.7","description":"Custom adonisjs/ally provider for Okta.","directories":{},"_nodeVersion":"16.15.1","dependencies":{"node-fetch":"^3.3.2"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^7.28.0","del-cli":"^3.0.1","prettier":"^2.3.1","copyfiles":"^2.4.1","typescript":"^4.3.2","@types/node":"^15.14.9","@adonisjs/ally":"^4.0.0","@adonisjs/core":"^5.1.8","eslint-plugin-adonis":"^1.3.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0"},"peerDependencies":{"@adonisjs/ally":"^4.0.0","@adonisjs/core":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/adonis5-ally-okta_1.0.1_1691731345435_0.035754681979609515","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@cambridge-pte/adonis5-ally-okta","version":"1.0.2","keywords":["adonisjs","adonis-ally"],"author":{"name":"Russel Herrera"},"license":"MIT","_id":"@cambridge-pte/adonis5-ally-okta@1.0.2","maintainers":[{"name":"rherreracup","email":"russel.herrera@cambridge.org"},{"name":"moris00","email":"moris.mascarinas@cambridge.org"},{"name":"jsunico-cupa","email":"renzo.sunico@cambridge.org"}],"homepage":"https://github.com/cambridge-pte/adonis5-ally-okta#readme","bugs":{"url":"https://github.com/cambridge-pte/adonis5-ally-okta/issues"},"dist":{"shasum":"1e749a32af4e9b4678f0b48026a56142afce690c","tarball":"https://registry.npmjs.org/@cambridge-pte/adonis5-ally-okta/-/adonis5-ally-okta-1.0.2.tgz","fileCount":9,"integrity":"sha512-M59pe/YzBXi3NiJnagmbJ6hXOTV6ZwcOX4VrgnAQzG9RBV+m+F0lslDqH5wEpmdC8WIz7tjrjAdCrQzev3N6nA==","signatures":[{"sig":"MEUCIQDq0GNux9m8orvaGJproLNgbniEzo2Cza/dtbjhefK2TQIgQyPlxzQP2Ce1DyXJ0sNU0y+RElINTAp3f+Hdlmcb+kI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":25574},"main":"build/providers/index.js","types":"./build/providers/index.d.ts","gitHead":"6f1901286f218084845bd841a7cd99dad8154b58","scripts":{"lint":"eslint . --ext=.ts","build":"npm run compile && npm run copyfiles","clean":"del build","format":"prettier --write .","compile":"npm run lint && npm run clean && tsc","version":"npm run build","copyfiles":"copyfiles \"instructions.md\" build","prepublishOnly":"npm run build"},"_npmUser":{"name":"rherreracup","email":"russel.herrera@cambridge.org"},"adonisjs":{"env":{"OKTA_DRIVER_SCOPES":"","OKTA_DRIVER_CLIENT_ID":"","OKTA_DRIVER_TOKEN_URL":"","OKTA_DRIVER_AUTHORIZE_URL":"","OKTA_DRIVER_CLIENT_SECRET":"","OKTA_DRIVER_RESPONSE_TYPE":"","OKTA_DRIVER_USER_INFO_URL":""},"types":"@cambridge-pte/adonis5-ally-okta","providers":["@cambridge-pte/adonis5-ally-okta"],"instructionsMd":"./build/instructions.md"},"repository":{"url":"git+https://github.com/cambridge-pte/adonis5-ally-okta.git","type":"git"},"_npmVersion":"9.8.1","description":"Custom adonisjs/ally provider for Okta.","directories":{},"_nodeVersion":"16.15.1","dependencies":{"node-fetch":"^3.3.2"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^7.28.0","del-cli":"^3.0.1","prettier":"^2.3.1","copyfiles":"^2.4.1","typescript":"^4.3.2","@types/node":"^15.14.9","@adonisjs/ally":"^4.0.0","@adonisjs/core":"^5.1.8","eslint-plugin-adonis":"^1.3.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0"},"peerDependencies":{"@adonisjs/ally":"^4.0.0","@adonisjs/core":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/adonis5-ally-okta_1.0.2_1691753041661_0.4796756036425993","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-08-10T07:03:53.029Z","modified":"2025-05-30T06:28:55.823Z","1.0.0":"2023-08-10T07:03:53.331Z","1.0.1":"2023-08-11T05:22:25.587Z","1.0.2":"2023-08-11T11:24:01.850Z"},"bugs":{"url":"https://github.com/cambridge-pte/adonis5-ally-okta/issues"},"author":{"name":"Russel Herrera"},"license":"MIT","homepage":"https://github.com/cambridge-pte/adonis5-ally-okta#readme","keywords":["adonisjs","adonis-ally"],"repository":{"url":"git+https://github.com/cambridge-pte/adonis5-ally-okta.git","type":"git"},"description":"Custom adonisjs/ally provider for Okta.","maintainers":[{"email":"moris.mascarinas@cambridge.org","name":"moris00"},{"email":"renzo.sunico@cambridge.org","name":"jsunico-cupa"},{"email":"russel.herrera@cambridge.org","name":"rherreracup"},{"email":"christian.rugeria@cambridge.org","name":"crugeria"},{"email":"educationtechnologysolutionsteam@cambridge.org","name":"educationtechnologysolutionsteam"}],"readme":"<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n\n## Table of contents\n\n- [Ally custom driver boilerplate](#ally-custom-driver-boilerplate)\n  - [Getting started](#getting-started)\n  - [How is the code structured?](#how-is-the-code-structured)\n    - [YourDriverAccessToken](#yourdriveraccesstoken)\n    - [YourDriverScopes](#yourdriverscopes)\n    - [YourDriverConfig](#yourdriverconfig)\n    - [YourDriver](#yourdriver)\n  - [Development checklist](#development-checklist)\n  - [Testing the driver](#testing-the-driver)\n  - [Release checklist](#release-checklist)\n  - [FAQ's](#faqs)\n    - [How do I define extra params during redirect?](#how-do-i-define-extra-params-during-redirect)\n    - [How do I define extra fields/params for the access token request?](#how-do-i-define-extra-fieldsparams-for-the-access-token-request)\n  - [Share with others](#share-with-others)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n# Ally custom driver boilerplate\n\n> A boilerplate for creating custom AdonisJS ally drivers\n\nThis repo serves as a starting point to create your custom OAuth2 drivers for [AdonisJS ally](https://docs.adonisjs.com/guides/auth/social).\n\nThe boilerplate is tailored to create one driver per project and publish it as a package on npm.\n\n## Getting started\n\nFollowing are the steps to get started.\n\n- Fork this repo and then clone it on your local machine.\n- Install all the dependencies using `npm` or `yarn` (whatever you prefer).\n- Open `package.json` file and update the package `name`, `description` and the `adonisjs` configuration block.\n\n  ```json\n  {\n    \"name\": \"package-name\",\n    \"description\": \"\",\n    \"adonisjs\": {\n      \"types\": \"package-name\",\n      \"providers\": [\"package-name\"]\n    }\n  }\n  ```\n\n## How is the code structured?\n\nThe code for the driver is inside the `src` directory. Make sure to change the `YourDriver` directory name to the name of the driver.\n\nThe driver implementation is mainly driven by the config, except the `user` and the `userFromToken` methods. Both of these methods are specific to the Oauth provider, and hence you have to implement them yourself.\n\nThe `src/YourDriver/index.ts` file has the following exports.\n\n#### YourDriverAccessToken\n\nThe type defines the properties that exist on the access token returned by your driver. You must read your OAuth provider documentation and list all the properties here.\n\n**Do not change the pre-defined `token` and `bearer` properties.**\n\n```ts\nexport type YourDriverAccessToken = {\n  token: string\n  type: 'bearer'\n}\n```\n\n#### YourDriverScopes\n\nDefine a union of driver scopes accepted by your OAuth provider. You can check out the [official implementations](https://github.com/adonisjs/ally/blob/develop/adonis-typings/ally.ts#L236-L268) to see how they are defined.\n\n#### YourDriverConfig\n\nThe type defines the configuration options that your driver expects. It must specify the following mentioned properties, along with any additional properties your driver needs to be functional.\n\n```ts\nexport type YourDriverConfig = {\n  driver: 'YourDriverName'\n  clientId: string\n  clientSecret: string\n  callbackUrl: string\n  authorizeUrl?: string\n  accessTokenUrl?: string\n  userInfoUrl?: string\n}\n```\n\n#### YourDriver\n\nThe driver implementation is a standard TypeScript class that extends the base `Oauth2Driver` class. The base driver class enforces you to define the following instance properties.\n\n- `authorizeUrl` is the URL for the redirect request. The user is redirected to this URL to authorize the request. Check out provider docs to find this URL.\n- `accessTokenUrl` is used to exchange the authorization code for the access token. Check out provider docs to find this URL.\n- `userInfoUrl` is used to make a request for getting the user profile information\n- `codeParamName` is the query string parameter for reading the **authorization code** after redirecting the user back to the callback URL.\n- `errorParamName` is the query string parameter for finding the error after redirecting the user back to the callback URL.\n- `stateCookieName` is the cookie name for storing the CSRF token (also known as the state). Make sure the cookie name does not collide with other drivers. A safer option is to prefix your driver name to the `oauth_state` keyword.\n- `stateParamName` is the query string parameter name for setting the state during the authorization redirect.\n- `scopeParamName` is the query string parameter name for sending the scopes during the authorization redirect.\n- `scopesSeparator` is the character to use for separating multiple parameters.\n\n## Development checklist\n\n- [ ] I have renamed all `YourDriver` references to a more meaningful driver name inside the `src/YourDriver/index.ts` file.\n- [ ] I have renamed the `YourDriverProvider` inside the `providers/index.ts` file.\n- [ ] I have updated the driver name in the `Ally.extend` method call inside the `providers/index.ts` file.\n- [ ] I have defined the `authorizeUrl` class property.\n- [ ] I have defined the `accessTokenUrl` class property.\n- [ ] I have defined the `userInfoUrl` class property.\n- [ ] I have defined the `codeParamName` class property.\n- [ ] I have defined the `errorParamName` class property.\n- [ ] I have defined the `stateCookieName` class property.\n- [ ] I have defined the `stateParamName` class property.\n- [ ] I have defined the `scopeParamName` class property.\n- [ ] I have defined the `scopesSeparator` class property.\n- [ ] I have implemented the `accessDenied` class method.\n- [ ] I have implemented the `user` class method.\n- [ ] I have implemented the `userFromToken` class method.\n- [ ] I have updated the `standalone.ts` file to export the renamed driver file name.\n\n## Testing the driver\n\nYou can test the driver by installing it locally inside your AdonisJS application. Following are the steps you need to perform.\n\n- Compile the TypeScript code to JavaScript using the `npm run build` script.\n- `cd` into your AdonisJS project and install the package locally using `npm i path/to/your/driver/package`.\n- Run `node ace configure <package-name>`. The configure command needs the package name and not the package path.\n- Inform typescript about your driver by defining a mapping inside the `contracts/ally.ts` file.\n\n  ```ts\n  import { YourDriverConfig, YourDriver } from 'ally-custom-driver/build/standalone'\n\n  interface SocialProviders {\n    yourDriver: {\n      config: YourDriverConfig\n      implementation: YourDriver\n    }\n  }\n  ```\n\n- Define the config inside the `config/ally.ts` file.\n- And now you can use your driver like any other inbuilt driver.\n\n## Release checklist\n\nMake sure to finish the following tasks before releasing your package.\n\n- [ ] I have renamed the `name` and `description` properties inside the `package.json` file.\n- [ ] I have renamed the `adonisjs.types` and `adonisjs.providers` properties to use the package name inside the `package.json` file.\n- [ ] I have updated the post-install instructions inside the `instructions.md` file.\n- [ ] I have updated the `adonisjs.env` property inside the `package.json` file to use the correct driver name for environment variables.\n\n## FAQ's\n\n### How do I define extra params during redirect?\n\nYou can configure the redirect request by implementing the `configureRedirectRequest` method on the driver class. The method is already pre-defined and commented out.\n\n```ts\nprotected configureRedirectRequest(request: RedirectRequest<YourDriverScopes>) {\n  request.param('key', 'value')\n}\n```\n\n### How do I define extra fields/params for the access token request?\n\nYou can configure the access token request by implementing the `configureAccessTokenRequest` method on the driver class. The method is already pre-defined and commented out.\n\n```ts\nprotected configureAccessTokenRequest(request: ApiRequest) {\n  // Request body\n  request.field('key', 'value')\n\n  // Query param\n  request.param('key', 'value')\n}\n```\n\n## Share with others\n\nAre you excited about sharing your work with others? Make sure to submit your package to the [awesome-adonisjs](https://github.com/adonisjs-community/awesome-adonisjs) repo.\n","readmeFilename":"README.md"}