mirror of
https://github.com/bitinflow/nuxt-oauth.git
synced 2026-03-13 13:45:59 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0981a12d08 | ||
|
|
36ccf819bd |
@@ -1,6 +1,8 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
|
||||||
|
## v1.0.3
|
||||||
|
|
||||||
## v1.0.2
|
## v1.0.2
|
||||||
|
|
||||||
## v1.0.0
|
## v1.0.0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bitinflow/nuxt-oauth",
|
"name": "@bitinflow/nuxt-oauth",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"description": "Nuxt 3 OAuth Module",
|
"description": "Nuxt 3 OAuth Module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export interface ModuleOptions {
|
|||||||
endpoints: {
|
endpoints: {
|
||||||
authorization: string,
|
authorization: string,
|
||||||
userInfo: string,
|
userInfo: string,
|
||||||
logout: string
|
logout: string | null
|
||||||
},
|
},
|
||||||
clientId: string,
|
clientId: string,
|
||||||
scope: string[]
|
scope: string[]
|
||||||
@@ -28,7 +28,7 @@ const defaults: ModuleOptions = {
|
|||||||
endpoints: {
|
endpoints: {
|
||||||
authorization: 'https://accounts.bitinflow.com/oauth/authorize',
|
authorization: 'https://accounts.bitinflow.com/oauth/authorize',
|
||||||
userInfo: `https://accounts.bitinflow.com/api/v3/user`,
|
userInfo: `https://accounts.bitinflow.com/api/v3/user`,
|
||||||
logout: 'https://accounts.bitinflow.com/logout'
|
logout: null,
|
||||||
},
|
},
|
||||||
clientId: 'please-set-client-id',
|
clientId: 'please-set-client-id',
|
||||||
scope: ['user:read']
|
scope: ['user:read']
|
||||||
|
|||||||
@@ -45,7 +45,17 @@ export default async (options: ComposableOptions = {
|
|||||||
accessToken.value = null;
|
accessToken.value = null;
|
||||||
user.value = null;
|
user.value = null;
|
||||||
|
|
||||||
return navigateTo(authConfig.endpoints.logout || authConfig.redirect.logout)
|
if (authConfig.endpoints.logout) {
|
||||||
|
// create oauth logout url
|
||||||
|
const params = new URLSearchParams({
|
||||||
|
client_id: authConfig.clientId,
|
||||||
|
redirect_uri: window.location.origin + authConfig.redirect.logout
|
||||||
|
})
|
||||||
|
|
||||||
|
window.location.href = `${authConfig.endpoints.logout}?${params.toString()}`
|
||||||
|
}
|
||||||
|
|
||||||
|
return navigateTo(authConfig.redirect.logout)
|
||||||
}
|
}
|
||||||
|
|
||||||
const setBearer = async (token: string, tokenType: string, expires: number) => {
|
const setBearer = async (token: string, tokenType: string, expires: number) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user