我在客户端使用以下代码:
import frAppLib from '@feathersjs/feathers'
import frRestLib from '@feathersjs/rest-client'
import auth from '@feathersjs/authentication-client'
import { CookieStorage } from 'cookie-storage'
const cookieStorage = new CookieStorage()
const authOptions = {
header: 'Authorization', // the default authorization header for REST
prefix: '', // if set will add a prefix to the header value. for example if prefix was 'JWT' then the header would be 'Authorization: JWT eyJ0eXAiOiJKV1QiLCJhbGciOi...'
path: '/authentication', // the server-side authentication service path
jwtStrategy: 'jwt', // the name of the JWT authentication strategy
entity: 'user', // the entity you are authenticating (ie. a users)
service: 'users', // the service to look up the entity
cookie: 'feathers-jwt', // the name of the cookie to parse the JWT from when cookies are enabled server side
storageKey: 'feathers-jwt', // the key to store the accessToken in localstorage or AsyncStorage on React Native
storage: cookieStorage // Passing a WebStorage-compatible object to enable automatic storage on the client.
}
const feathers = frAppLib()
const apiUrl = process.env.NODE_ENV == 'production'
? 'http://localhost:3030' //TODO
: 'http://localhost:3030'
const frRest = frRestLib(apiUrl)
feathers.configure(frRest.fetch(window.fetch))
feathers.configure(auth(authOptions))
export default feathers
我的注销代码是:
import feathers from '@/feathers.js'
async logoutClick() {
await feathers.logout()
this.$router.replace('/login')
}
我的问题如下:
- 我在我的应用程序中登录
- 在浏览器的另一个选项卡中打开我的应用
- 使用我的应用返回第一个选项卡,然后单击注销
在第一个选项卡注销之后就可以了,但浏览器不会将删除发送到授权服务到服务器。我在浏览器网络活动中看不到它
因此,我在浏览器第二个选项卡中的应用程序仍处于登录状态。
如何注销浏览器的所有选项卡,我的应用程序在哪里打开?