Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

@okta/okta-react@1.2.1 #517

Merged
merged 3 commits into from
Aug 22, 2019
Merged

@okta/okta-react@1.2.1 #517

merged 3 commits into from
Aug 22, 2019

Conversation

aarongranick-okta
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Adding Tests
  • Build related changes
  • CI related changes
  • Documentation changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Bump version

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

See pending release: https://github.com/okta/okta-oidc-js/releases

Reviewers

@aarongranick-okta
Copy link
Contributor Author

Requires updates to configuration-validation module: #529

@aarongranick-okta aarongranick-okta force-pushed the okta-react@1.2.1 branch 4 times, most recently from 6c55ce6 to bb58066 Compare August 20, 2019 21:52
- PKCE support, @okta/okta-auth-js@2.6.3
<Link to='/'>Home</Link><br/>
<Link to='/protected'>Protected</Link><br/>
<Link to='/sessionToken-login'>Session Token Login</Link><br/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Mixing hypenation and camelCase? ick

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this our test harness app.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The URL already exists and is being used in the E2E tests. I just added a link on the page so we don't have to keep typing it in when we are testing manually.

ReactDOM.render(<App />, document.getElementById('root'));
// To perform end-to-end PKCE flow we must be configured on both ends: when the login is initiated, and on the callback
// The login page is loaded with a query param. This will select a unique callback url
// On the callback load we detect PKCE by inspecting the pathname
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this information devs using this SDK would need to know/implement? If not, why is this test different than our sample code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our samples use environment variable, you would have to restart the server to switch PKCE on or off.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method I am using here is more brittle, and would not be recommended for users. But to use environment variables I would need to run 2 completely separate test cycles and run the webpack again.

- **issuer** (required) - The OpenId Connect `issuer`
- **client_id** (required) - The OpenId Connect `client_id`
- **redirect_uri** (required) - Where the callback handler is hosted
- **clientId** (required) - The OpenId Connect `client_id`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm 90% sure I know the answer, but what happens to users of the old standard?

If we're deprecating the old snake_case method, we should indicate that somewhere so users understand why their code works (per above) when it doesn't match the docs. The changelog would satisfy me on that if it shows up there (and thus not in this PR), but we need to make sure it does show up there in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add note to the changelog

- **scope** *(optional)* - Reserved or custom claims to be returned in the tokens. Default: `['openid', 'email', 'profile']`
- **response_type** *(optional)* - Desired token types. Default: `['id_token', 'token']`
- **grantType** *(optional)* - Can be `implicit` (default) or `authorization_code` (for PKCE flow)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was grantType ever published for okta-react, or is this leftover from earlier work in this same release?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its left over, we have not released pkce support for react yet

- **onAuthRequired** *(optional)* - callback function

Accepts a callback to make a decision when authentication is required. If this is not supplied, `okta-react` redirects to Okta. This callback will receive `auth` and `history` parameters. This is triggered when:
1. `auth.login` is called
2. SecureRoute is accessed without authentication

- **storage** *(optional)*:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These moved to the Auth config, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These, and all other supported options are part of the "Configuration refernence" (I point them to okta-auth-js). pkce, secure, etc. are also located here.

@@ -228,8 +219,17 @@ class App extends Component {
}
```

#### Alternate configuration using `Auth` object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on this section - very clear, very helpful


Assuming you have configured your application to allow the `Authorization code` grant type, simply pass `pkce=true` to the `Security` component. This will configure the `Auth` object to perform PKCE flow for both login and token refresh.

```typescript
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these all flagged as TS instead JS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it makes the jsx tags prettier

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dev blog supports jsx as a language type. Maybe the new docs site does too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<Router>
<Security issuer='https://{yourOktaDomain}.com/oauth2/default'
clientId='{clientId}'
pkce=true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be {true}? IIRC JSX props are either a braced expression or a string literal, no boolean.

@aarongranick-okta aarongranick-okta merged commit 0453f1d into master Aug 22, 2019
@aarongranick-okta aarongranick-okta deleted the okta-react@1.2.1 branch August 22, 2019 18:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants