ẁindow.localStorage
for my needs. If you need i can gave you some sample-code for OAuth2 with https://discordapp.com
server.js
:)
bindRequestInterceptor()
and bindResponseInterceptor()
methods though (I use axios). I eventually found out that these belong into the options of the Vue.use()
, but maybe that could be highlighted in the corresponding section of the help?
// === DEFAULT / CUSTOM STYLE ===
// WARNING! always comment out ONE of the two require() calls below.
// 1. use next line to activate CUSTOM STYLE (./src/themes)
// require(./themes/app.${__THEME}.styl
)
// 2. or, use next line to activate DEFAULT QUASAR STYLE
require(quasar/dist/quasar.${__THEME}.css
)
// ==============================
import Vue from 'vue'
import Quasar from 'quasar'
import router from './router'
import vuelidate from 'vuelidate'
import VueResource from 'vue-resource'
import VueAuthenticate from 'vue-authenticate'
Vue.use(Quasar) // Install Quasar Framework
Vue.use(vuelidate)
// TODO use axios instead of vueresource
Vue.use(VueResource)
// TODO move to separate file
Vue.use(VueAuthenticate, {
baseUrl: 'http://localhost:8080',
providers: {
oauth2: {
name: 'oauth2',
url: 'Token/Exchange',
authorizationEndpoint: 'http://localhost:5000/connect/authorize', // if this ends with slash --> game over
redirectUri: window.location.origin || window.location.protocol + '//' + window.location.host,
scope: ['profile', 'openid', 'PanelButlerApi'],
responseParams: {
code: 'code',
clientId: 'clientId',
redirectUri: 'redirectUri'
},
responseType: 'code',
// responseParams: {
// code: 'code',
// token: 'access_token',
// state: 'state',
// sessionState: 'session_state',
// clientId: 'clientId',
// redirectUri: 'redirectUri'
// },
scopePrefix: '',
scopeDelimiter: ' ',
// defaultUrlParams: ['client_id', 'scope', 'response_type', 'redirect_uri', 'state', 'nonce'],
defaultUrlParams: ['response_type', 'client_id', 'redirect_uri'],
requiredUrlParams: ['scope', 'nonce'],
optionalUrlParams: ['display', 'state'],
state: function () {
var val = ((Date.now() + Math.random()) * Math.random()).toString().replace('.', '')
return encodeURIComponent(val)
},
display: 'popup',
oauthType: '2.0',
clientId: 'PanelButlerVueJs',
nonce: function () {
var val = ((Date.now() + Math.random()) * Math.random()).toString().replace('.', '')
return encodeURIComponent(val)
},
popupOptions: { width: 452, height: 633 }
}
}
})
Quasar.start(() => {
/ eslint-disable no-new /
new Vue({
el: '#q-app',
router,
render: h => h(require('./App'))
})
})