okta / samples-js-react

React Auth SDK sample
Other
174 stars 257 forks source link

:seedling: Add custom scopes to authorisation request #277

Open kelvin-chappell opened 1 year ago

kelvin-chappell commented 1 year ago

This change enables the Okta-hosted login app to request additional custom access scopes when authorising.

Custom scopes can now be added as an optional property called CUSTOM_SCOPES in the testenv property file. Each scope is space separated. Eg.

CUSTOM_SCOPES=read write

These scopes are then added to the default list and included in the token request.

Mark-McCracken commented 1 year ago

@jaredperreault-okta can you give this a review and merge if you're happy please?

jaredperreault-okta commented 1 year ago

@kelvin-chappell @Mark-McCracken Do you mind explaining your use case?

kelvin-chappell commented 1 year ago

@kelvin-chappell @Mark-McCracken Do you mind explaining your use case?

At the moment, if you need to generate an access token with more than the default access scopes configured here you have to search through the code and add them to that array. By making this a configurable environment variable we improve the dev experience and make it very easy to see, and modify, what scopes have been requested with the token.

Mark-McCracken commented 1 year ago

@jaredperreault-okta I've been using this for the last few days, which has been helpful for getting certain kinds of access tokens. Do you need anything to get this merged?