mirror of
https://github.com/bitinflow/nuxt-oauth.git
synced 2026-03-13 05:35:59 +00:00
Make options optional
Revert default routes Update documentation
This commit is contained in:
@@ -50,8 +50,8 @@ export default defineNuxtConfig({
|
||||
ssr: false,
|
||||
// or
|
||||
routeRules: {
|
||||
'/account/**': {ssr: false},
|
||||
'/auth/**': {ssr: false}
|
||||
'/dashboard/**': {ssr: false},
|
||||
'/whatever/**': {ssr: false}
|
||||
},
|
||||
|
||||
// using code response type (default)
|
||||
|
||||
13
UPGRADE.md
13
UPGRADE.md
@@ -11,16 +11,3 @@ is [not recommended](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-secu
|
||||
want to use the `token` response type, you need to set it explicitly with `responseType: 'token'` in the
|
||||
`oauth` configuration. Otherwise, you will use Authorization Code Grant with PKCE by default.
|
||||
|
||||
### Refactor default `login` and `callback` routes to `/auth/login`
|
||||
|
||||
We nested all authentication related routes under `/auth` prefix, so it aligned with our documentation and
|
||||
provided a better default configuration. If you want to use the old routes, you need to update your `oauth`
|
||||
configuration:
|
||||
|
||||
```
|
||||
endpoints: {
|
||||
login: '/login',
|
||||
callback: '/login',
|
||||
},
|
||||
```
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ export default defineNuxtConfig({
|
||||
ssr: false,
|
||||
|
||||
oauth: {
|
||||
redirect: {
|
||||
home: '/home'
|
||||
},
|
||||
clientId: '98e1cb74-125a-4d60-b686-02c2f0c87521',
|
||||
scope: ['user:read']
|
||||
},
|
||||
|
||||
@@ -9,7 +9,7 @@ definePageMeta({
|
||||
|
||||
const { $api } = useNuxtApp()
|
||||
|
||||
$api.get('users/@me')
|
||||
$api.get('user')
|
||||
.then((response: any) => {
|
||||
console.log(response.data)
|
||||
})
|
||||
@@ -20,7 +20,7 @@ $api.get('users/@me')
|
||||
|
||||
<template>
|
||||
<div v-if="user">
|
||||
Hello {{ user.name }}
|
||||
Hello {{ user.data.first_name }}
|
||||
|
||||
<button @click="signOut">
|
||||
Sign Out
|
||||
|
||||
@@ -7,7 +7,7 @@ export default defineNuxtPlugin(async () => {
|
||||
const {bearerToken, accessToken} = await useAuth();
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: 'https://id.stream.tv/api/',
|
||||
baseURL: 'https://accounts.bitinflow.com/api/v3/',
|
||||
headers: {
|
||||
common: {
|
||||
'Authorization': bearerToken(),
|
||||
|
||||
@@ -3,32 +3,32 @@ import defu from "defu";
|
||||
|
||||
// Module options TypeScript interface definition
|
||||
export interface ModuleOptions {
|
||||
redirect: {
|
||||
login: string,
|
||||
logout: string,
|
||||
callback: string,
|
||||
home: string
|
||||
redirect?: {
|
||||
login?: string,
|
||||
logout?: string,
|
||||
callback?: string,
|
||||
home?: string
|
||||
},
|
||||
endpoints: {
|
||||
authorization: string,
|
||||
token: string,
|
||||
userInfo: string,
|
||||
logout: string | null
|
||||
endpoints?: {
|
||||
authorization?: string,
|
||||
token?: string,
|
||||
userInfo?: string,
|
||||
logout?: string | null
|
||||
},
|
||||
refreshToken: {
|
||||
refreshToken?: {
|
||||
maxAge: number,
|
||||
}
|
||||
clientId: string,
|
||||
responseType: 'token' | 'code',
|
||||
prompt: '' | 'none' | 'login' | 'consent',
|
||||
scope: string[]
|
||||
clientId?: string,
|
||||
responseType?: 'token' | 'code',
|
||||
prompt?: '' | 'none' | 'login' | 'consent',
|
||||
scope?: string[]
|
||||
}
|
||||
|
||||
const defaults: ModuleOptions = {
|
||||
redirect: {
|
||||
login: '/auth/login',
|
||||
login: '/login',
|
||||
logout: '/',
|
||||
callback: '/auth/login',
|
||||
callback: '/login',
|
||||
home: '/'
|
||||
},
|
||||
endpoints: {
|
||||
|
||||
Reference in New Issue
Block a user