Commit Graph

2126 Commits

Author SHA1 Message Date
Iain Collins
2f61795697 Add verification of URL prefix cookie
Improves security and defence against bad actors by adding a hash that uses the secret as a salt and checking it on every request (and overriding the cookie with a new secure one if the check fails.)
2020-05-17 17:45:00 +01:00
Iain Collins
d5257fe1db Add signout page
This commit does not include handling of actual signout request.
2020-05-17 17:45:00 +01:00
Iain Collins
822fbee0c4 Fix bugs with server side session handling
* Sets site name + api route now prior to sign in so avalible sooner.
* Improved next-auth/client logic for server side session handling.
* next-auth/client now checks regular and `__Secure-` prefixed cookies.
2020-05-17 17:45:00 +01:00
Iain Collins
937f9cdfda Fix case sensitivy of prefix for secure cookies 2020-05-17 17:45:00 +01:00
Iain Collins
2bb9355933 Improve signin page
* Better contrast
* Displays site name correctly
2020-05-17 17:45:00 +01:00
Iain Collins
57a9021107 Add route to return CSRF token to clients 2020-05-17 17:45:00 +01:00
Iain Collins
71fecfb1f2 Standardize done() call for routes 2020-05-17 17:45:00 +01:00
Iain Collins
1b374817f0 Improve and standardize how responses are returned
Use .status() and .json() where possible.
2020-05-17 17:45:00 +01:00
Iain Collins
eee927a6cd Add CSRF token and improve cookie security
Better default security for cookies, without impacting UX or DX.

Further work to do on CSRF protection, but this is a good start.
2020-05-17 17:45:00 +01:00
Iain Collins
0fabfa4ef9 Add viewport metatag to pages for mobile devices 2020-05-17 17:45:00 +01:00
Iain Collins
57bf54c28d Fix useEffect() warning in client
Technically useEffect should not return a value, or generates a warning.
2020-05-17 17:45:00 +01:00
Iain Collins
9bbc9100ab Update documentation 2020-05-17 17:45:00 +01:00
Iain Collins
e6cd78d71b Bump version number to publish new README 2020-05-17 17:45:00 +01:00
Iain Collins
3d66b90cf8 Update README.md 2020-05-17 17:45:00 +01:00
Iain Collins
ebfb02bd12 Bump version number to update docs 2020-05-17 17:45:00 +01:00
Iain Collins
2032ff1276 Update README 2020-05-17 17:45:00 +01:00
Iain Collins
08582aad83 Fix bugs with parsing options
Some of the logic was wrong following refactoring.
2020-05-17 17:45:00 +01:00
Iain Collins
c9944820c6 Fix bug in client session method
Introduced when refactoring error handling
2020-05-17 17:45:00 +01:00
Iain Collins
0697609dd0 Add beta tag to version
While it is still somewhere between an alpha and a beta am publishing to NPM to facilitate further testing.

The software is not ready for use yet!

While belived to be functional there are no formal tests and only casual manual testing has been done.

Features such as logout and session expiry checks have not yet been implemented.
2020-05-17 17:45:00 +01:00
Iain Collins
39d3689c22 Improve client error handling 2020-05-17 17:45:00 +01:00
Iain Collins
43023293ea Remove install script
No longer needed.
2020-05-17 17:45:00 +01:00
Iain Collins
91f319bc5f Add script to run build after install
This is to temporarily facilitate testing.
2020-05-17 17:45:00 +01:00
Iain Collins
f847488643 Improve error handling in client 2020-05-17 17:45:00 +01:00
Iain Collins
731e227cb6 Update babel config 2020-05-17 17:45:00 +01:00
Iain Collins
f2aafac40c Update formatting in README.md 2020-05-17 17:45:00 +01:00
Iain Collins
5bff4cb07f Add hook, improve client, cookies and docs
* Added React Hook to client.
* NextAuth.session() is now a universal method.
* Improved cookie support, all cookie names and options can be customised (feature request).
* Updated examples in documentation.
2020-05-17 17:45:00 +01:00
Iain Collins
06ef47cc40 Update client and documentation
This is very much a work in progress!
2020-05-17 17:45:00 +01:00
Iain Collins
3e0e4ecb5d Add simple client 2020-05-17 17:45:00 +01:00
Iain Collins
651f3c9887 Improve session and account linking 2020-05-17 17:45:00 +01:00
Iain Collins
cfbe24fc24 Add sessions
While not all signup flows are complete, basic core functionality is now working.

Users can sign in, have their identify verified and session is created for them in a secure manner.

* Added Session model and schema.
* Added createSession and getSessionByID handlers.
 * Added getUserByID handler.
 * Added /api/auth/session endpoint which displays info about the current session.
 * /api/auth/session endpoint is secure as it requires the HTTP only cookie.
 * Remove schema relationship data for now (no value currently and may cause problems if not modeled correctly).
2020-05-17 17:45:00 +01:00
Iain Collins
9432cfda90 Add Preact and PostCSS for pages
We need to be able to return simple server-side rendered pages for authentication (e.g. signin).

Using Preact means we can use JSX in them while keeping depedancy size small.

Ultimately, these pages should be customizable - both by passing in CSS and by specifying custom URL for page.

Additionally, the babel config has been tweaked to reduce bundle size by minifying assets and stripping comments from built assets.
2020-05-17 17:45:00 +01:00
Iain Collins
981adaae24 Update README.md 2020-05-17 17:45:00 +01:00
Iain Collins
ec3da81887 Add option to extend models / use custom models 2020-05-17 17:45:00 +01:00
Iain Collins
d150a7911c Update documentation 2020-05-17 17:45:00 +01:00
Iain Collins
018738bcc0 List files to be published to NPM in package.json 2020-05-17 17:45:00 +01:00
Iain Collins
e37e20faf5 Add babel config for esmodule
This allows next-auth to be imported into Node.js projects.
2020-05-17 17:45:00 +01:00
Iain Collins
4bf13394f1 Add database adapter and models
* Uses typeorm as works with a large number of data stores.
* Compatible with common SQL, document storage & lightweight databases.
* Adapter logic integrated into signup flow but not yet complete.
2020-05-17 17:45:00 +01:00
Iain Collins
3dad0cc849 Apply custom provider options after default
Makes it easier to override options as needed.
2020-05-17 17:45:00 +01:00
Iain Collins
ea69d1e904 Initial commit of signin flow
* Flow not fully complete or tested, but can complete signin journey.
* Does not include source code for adapter (test adapater source currently in client respository while under development).
* Wrapped all calls in promise to avoid early termination of serverless function.
* Callback and Session cookie names and cookie options can now be changed by passing options for them in (feature request from 1.x).
2020-05-17 17:45:00 +01:00
Iain Collins
b666cde7a7 Update README.md and configuration
* Renamed the `serverUrl` configuration variable to `site`.
* Improved cosmetic apperance of place holder sign in page.
2020-05-17 17:45:00 +01:00
Iain Collins
e3784bba9d Initial commit of next-auth 2.0
* Redesigned from the ground up for serverless!
* Doesn't require PassportJS or Express!
* Much simpler configuration!
* Interface exposed via single API endpoint.
* Supports both oAuth 1.x and 2.x services.
* Initial commit includes support for signing in with Twitter, Google and GitHub.

Code is functional, but not useable as adapter support (saving user information) is still in progress.

Still to come:

* Support for Facebook, email, and  credential authentication flows.
* Adapter support - will provide out of the box support for MongoDB, Elasticsearch and SQL with support for writing custom adapters in a similar style to version 1.x.
* Automated User Acceptance Tests for all auth flows.
* Example usage . In a change from version 1.x a demo will exist in a seperate repository to make it easier to get started.
2020-05-17 17:45:00 +01:00
dependabot[bot]
6eec05567d Bump lodash from 4.17.11 to 4.17.15 in /example
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.15.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.15)

Signed-off-by: dependabot[bot] <support@github.com>
2020-05-09 17:32:24 +01:00
dependabot[bot]
556f4ff2ce Bump mixin-deep from 1.3.1 to 1.3.2 in /example
Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
- [Commits](https://github.com/jonschlinkert/mixin-deep/compare/1.3.1...1.3.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-05-09 14:41:04 +01:00
dependabot[bot]
a8af12d16b Bump lodash from 4.17.10 to 4.17.15
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.10 to 4.17.15.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.10...4.17.15)

Signed-off-by: dependabot[bot] <support@github.com>
2020-05-09 14:40:51 +01:00
Iain Collins
fc8490e64c Update version to 1.13.0
This version will (probably) not be published, at least not until 2.0 ships in the next few weeks.

This release contains several untested fixes and enhancements that were not in the last released version version of 1.x (1.12.1).

I would like to publish it then, so that it can be archived and available to those still using the 1.x branch after release of 2.0.
v1.13.0
2020-05-09 14:32:03 +01:00
ndo@ndo1
b126fcc737 update: index.js dotenv fix 2020-05-09 02:30:57 +01:00
ndo@ndo1
83cd2d1883 fix: dotenv loading 2020-05-09 02:30:57 +01:00
Richard Lewis
ee10fcd37e Allow customisation of session cookie name and sameSite value.
Allow customisation of session cookie name and sameSite value.
2020-05-09 02:28:51 +01:00
Chafik
40d5c25bf1 Fix file name in providers section 2020-05-03 17:41:38 +01:00
Mark Langovoi
f52ccae5a5 Move babel-core and rollup-plugin-babel to dev dependencies (#73) 2019-07-24 04:12:30 +01:00