-
Notifications
You must be signed in to change notification settings - Fork 57
WIP: Simplify token strategy configuration #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
robertjd
wants to merge
1
commit into
master
Choose a base branch
from
simplify-token-strategy
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,23 @@ | ||
| ## 3.0.0 (TBD) | ||
|
|
||
| This release simplifies the [Stormpath Client API][] behaviour that was introduced in 2.0.0, the SDK now works in the following way: | ||
|
|
||
| - By default, it will use the OAuth Token strategy, which means that: | ||
| - Login attemps are posted to `/oauth/token` | ||
| - Local storage is used to store the token. | ||
| - Use `ReactStormpath.getAccesToken()` to get the access token and attach it to requests, as needed. | ||
| - This strategy with the Client API and with servers that are running our framework integrations, such as [Express-Stormpath][]. | ||
|
|
||
| - We still provide a cookie strategy, allowing you to use cookies to store and send the access token to your server. | ||
|
|
||
| For both cases, please see the [README][] and the [Upgrade Guide][] for specific examples of how to use this new version. | ||
|
|
||
|
|
||
| ## 2.0.0 (January 13, 2017) | ||
|
|
||
| This release adds support for the [Stormpath Client API][], which allows you to authenticate the user directly with Stormpath (authentication does not require extra software in your server). The user receives an access token, which can be used to authorize requests on your server. If you need to authorize requests on your server, you will sill want to use one of our SDKs to make that process simpler. | ||
| *Deprecated* Please use 3.0.0 insetad. | ||
|
|
||
| Please see the Readme for the new instructions for using the Client API. | ||
| This release adds support for the [Stormpath Client API][], which allows you to authenticate the user directly with Stormpath (authentication does not require extra software in your server). The user receives an access token, which can be used to authorize requests on your server. If you need to authorize requests on your server, you will sill want to use one of our SDKs to make that process simpler. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another typo. "sill want" -> "still want" |
||
|
|
||
| ## 1.3.4 (January 9, 2017) | ||
|
|
||
|
|
@@ -107,4 +122,7 @@ Features: | |
| - Add support for new error structure ([#35](https://github.com/stormpath/stormpath-sdk-react/pull/35)) | ||
| - Add X-Stormpath-Agent header to requests ([#31](https://github.com/stormpath/stormpath-sdk-react/pull/31)) | ||
|
|
||
| [Express-Stormpath]: https://github.com/stormpath/express-stormpath | ||
| [README]: https://github.com/stormpath/stormpath-sdk-react#stormpath-react-sdk | ||
| [Stormpath Client API]: https://docs.stormpath.com/client-api/product-guide/latest/index.html | ||
| [Upgrade Guide]: https://github.com/stormpath/stormpath-sdk-react/blob/master/UPGRADE.md | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,16 +68,18 @@ Stormpath already integrated!* | |
|
|
||
| 3. **Initialize the SDK** | ||
|
|
||
| The React SDK leverages the [Stormpath Client API][] for its authentication needs. Login to your Stormpath Tenant, and find your Client API domain (inside your application's policy section). Add your Client API domain as the `endpoints.baseUri` setting when initializing `ReactStormpath`: | ||
| The React SDK uses the [Stormpath Client API][] for its authentication needs. Login to your Stormpath Tenant, and find your Client API domain (inside your application's policy section). Add your Client API domain as the `endpoints.baseUri` setting when initializing `ReactStormpath`: | ||
|
|
||
| ```javascript | ||
| ReactStormpath.init({ | ||
| endpoints: { | ||
| baseUri: 'https://{{clientApiDomainName}}' | ||
| baseUri: 'https://YOUR_CLIENT_API_DOMAIN.apps.stormpath.io' | ||
| } | ||
| }); | ||
| ``` | ||
|
|
||
| Some alternate configurations available, e.g. if you want to use cookies (rather then the default local storage) for access token storage. Please see the [Stormpath React SDK API Documentation][] for details. | ||
|
|
||
| 4. **Configure the Router** | ||
|
|
||
| In the file where you setup your [React Router][] routes, change your [`ReactRouter.Router`][] to [`ReactStormpath.Router`][] as shown below: | ||
|
|
@@ -193,7 +195,7 @@ Stormpath already integrated!* | |
|
|
||
| 10. **That's It!** | ||
|
|
||
| You just added user authentication to your React app with Stormpath, you should now be able to register and login! See the [API Documentation][] for further information on how Stormpath can be used with your React app. Once you have been able to successfully log in, the next section will discuss integrating with your own server. | ||
| You just added user authentication to your React app with Stormpath, you should now be able to register and login! See the [Stormpath React SDK API Documentation][] for further information on how Stormpath can be used with your React app. Once you have been able to successfully log in, the next section will discuss integrating with your own server. | ||
|
|
||
| 11. **Making Authenticated Requests** | ||
|
|
||
|
|
@@ -247,7 +249,7 @@ Stormpath already integrated!* | |
|
|
||
| ## Documentation | ||
|
|
||
| For all available routes and components, see the [API Documentation][]. | ||
| For all available routes and components, see the [Stormpath React SDK API Documentation] Documentation][]. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra |
||
|
|
||
| ## Example | ||
|
|
||
|
|
@@ -295,7 +297,7 @@ Apache 2.0, see [LICENSE](LICENSE). | |
| [`ReactStormpath.init()`]: https://github.com/stormpath/stormpath-sdk-react/blob/master/docs/api.md#initialization | ||
| [`ReactStormpath.Router`]: https://github.com/stormpath/stormpath-sdk-react/blob/master/docs/api.md#router | ||
| [`RegistrationForm`]: https://github.com/stormpath/stormpath-sdk-react/blob/master/docs/api.md#registrationform | ||
| [API Documentation]: https://github.com/stormpath/stormpath-sdk-react/blob/master/docs/api.md | ||
| [Stormpath React SDK API Documentation]: https://github.com/stormpath/stormpath-sdk-react/blob/master/docs/api.md | ||
| [example app]: https://github.com/stormpath/stormpath-express-react-example | ||
| [express-stormpath]: https://github.com/stormpath/express-stormpath | ||
| [React Router]: https://github.com/rackt/react-router | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| export BaseService from './BaseService'; | ||
| export RequestPool from './RequestPool'; | ||
| export UserService from './UserService'; | ||
| export ClientApiUserService from './ClientApiUserService'; | ||
| export StormpathCookieUserService from './stormpath-cookie-user-service'; | ||
| export OAuthTokenUserService from './oauth-token-user-service'; |
4 changes: 2 additions & 2 deletions
4
src/services/ClientApiUserService.js → src/services/oauth-token-user-service.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo there. "instead"