From 1b048cf36604cbfbd7f5eae0781de2b2169584ed Mon Sep 17 00:00:00 2001 From: Marijn van der Horst Date: Thu, 5 Mar 2020 11:44:47 +0100 Subject: [PATCH] Updated Readme --- README.md | 135 ++++++++++++++++++++++------------------------ package-lock.json | 2 +- package.json | 2 +- 3 files changed, 67 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index 5373564..e196880 100644 --- a/README.md +++ b/README.md @@ -1,91 +1,86 @@ -# Checklist REMOVE AFTER CHECKING - -Go through this checklist after creating your repository. It should only take a couple of minutes. If you encounter any issues, let someone from IT know. - -### README -- [ ] Manually go through and edit the rest of the README. - -### Dotfiles -- [x] Add a `.gitignore` file. - -### GitHub Settings -- [ ] Add a short description to the repository. -- [ ] Add a develop branch. -- [ ] Set develop branch as default branch. -- [ ] Enable all data services (read-only analysis, dependency graph, security alerts). -- [ ] Create branch protection rules for master: - - [ ] Require pull request review before merging. - - [ ] Require 2 reviews. (One for the code and testing (DevOps), and one for semantics) - - [ ] Dismiss stale pull request approvals when new commits are pushed. - - [ ] Require status checks before merging. -- [ ] Create branch protection rules for develop: - - [ ] Require pull request review before merging. - - [ ] Require 2 reviews. (One for the code and testing (DevOps), and one for semantics) - - [ ] Dismiss stale pull request approvals when new commits are pushed. - - [ ] Require status checks before merging. -- [ ] Add a .travis.yml file. - - [ ] Add the codecov token to env variables. -- [ ] [OPTIONAL] Add a codecov.yml -- [ ] Enable the status checks for travis and codecov. - -# MRD Auth0 SPA Vue.js - -Vue.js wrapper for [auth0-spa-js](https://github.com/auth0/auth0-spa-js). -As seen in Auth0's [Vue: Login Tutorial](https://auth0.com/docs/quickstart/spa/vuejs/). - -## Getting Started - -These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. - -### Prerequisites +# MRD Auth0 SPA Vue -What things you need to install the software and how to install them +Vue wrapper for [auth0-spa-js](https://github.com/auth0/auth0-spa-js). +As seen in Auth0's [Vue: Login Tutorial](https://auth0.com/docs/quickstart/spa/vuejs/). +## Usage +1. Make sure an application in the Auth0 dashboard has been created. +2. Install this package, using `npm install @marketredesign/auth0-spa-vue`. +3. Import the `Auth0Plugin` Vue plugin, and optionally the `authGuard` into your application, using +`import { Auth0Plugin, authGuard } from "@marketredesign/auth0-spa-vue";` +4. Register the plugin with Vue: +```javascript +Vue.use(Auth0Plugin, { + domain: 'The Auth0 login domain', + clientId: 'Auth0 client ID for this application', + onRedirectCallback: appState => { + router.push( + appState && appState.targetUrl + ? appState.targetUrl + : 'default redirect' + ); + } +}); ``` -Give examples -``` - -### Installing - -A step by step series of examples that tell you how to get a development env running - -Say what the step will be +### Log in to the App +Example template providing a login button: +```vue + ``` -Give the example -``` - -And repeat -``` -until finished +Define the login and logout functions for instance as follows. +```javascript +login() { + this.$auth.loginWithRedirect(); +} + +logout() { + this.$auth.logout({ + returnTo: window.location.origin + }); +} ``` -End with an example of getting some data out of the system or using it for a little demo +### User profile information +Once the user authenticates, the SDK extracts the user's profile information and stores it in memory. +It can be accessed using `this.$auth.state.user` from inside a Vue component. -## Running the tests +### Protecting routes +Routes can be protected by specifying `beforeEnter: authGuard`. -Explain how to run the automated tests for this system. - -### Break down into end to end tests +## Getting Started -Explain what these tests test and why. +These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. +See deployment for notes on how to deploy the project to NPM. -``` -Give an example -``` +### Prerequisites -### And coding style tests +* NodeJS >= 10 -Explain what these tests test and why. +### Installing -``` -Give an example -``` +1. Clone the repository +2. Execute `npm install` ## Deployment -Add additional notes about how to deploy this on a live system +1. Make sure you are logged into NPM using `npm adduser` +2. Verify the version is correct using `npm version` +3. Publish the package using `npm publish` ## Authors diff --git a/package-lock.json b/package-lock.json index b0b9aa8..f1a86ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@marketredesign/auth0-spa-vue", - "version": "1.0.5", + "version": "1.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a1756a7..7495301 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@marketredesign/auth0-spa-vue", - "version": "1.0.5", + "version": "1.1.0", "description": "Vue.js wrapper for auth0-spa-js", "main": "src/index.js", "scripts": {