mirror of
https://github.com/bitinflow/nuxt-oauth.git
synced 2026-03-13 21:56:00 +00:00
Compare commits
6 Commits
envoyr-pat
...
ghostzero-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
197a1a5c8d | ||
|
|
df53718392 | ||
|
|
ce2ced4ffa | ||
|
|
7384a4c5ce | ||
|
|
eff160b3c5 | ||
|
|
464e72535b |
22
.github/workflows/package.yml
vendored
Normal file
22
.github/workflows/package.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
name: Node.js Package
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '19.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
scope: '@bitinflow'
|
||||
- run: npm install
|
||||
- run: npm run build
|
||||
- run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
@@ -1,6 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
|
||||
## v2.0.2
|
||||
|
||||
## v2.0.1
|
||||
|
||||
Typo fixes in the GitHub/NPM repo
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@bitinflow/nuxt-oauth",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.3",
|
||||
"description": "Nuxt 3 OAuth Module",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
@@ -21,6 +21,7 @@
|
||||
"dev": "nuxi dev playground",
|
||||
"dev:build": "nuxi build playground",
|
||||
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
|
||||
"build": "npm run lint && npm run test && npm run prepack",
|
||||
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && git push --follow-tags",
|
||||
"push": "npm publish --access public",
|
||||
"lint": "eslint .",
|
||||
|
||||
@@ -74,7 +74,7 @@ export default async (options: ComposableOptions = {
|
||||
window.location.href = `${authConfig.endpoints.logout}?${params.toString()}`
|
||||
}
|
||||
|
||||
return navigateTo(authConfig.redirect.logout)
|
||||
return navigateTo(authConfig.redirect.logout, { external: true })
|
||||
}
|
||||
|
||||
const setBearerToken = async (token: string, tokenType: string, expires: number): Promise<void> => {
|
||||
|
||||
@@ -25,7 +25,7 @@ export default defineNuxtPlugin(() => {
|
||||
const expires = hashParams.get('expires_in') as string;
|
||||
|
||||
await setBearerToken(token, tokenType, parseInt(expires));
|
||||
return navigateTo(authConfig.redirect.home)
|
||||
return navigateTo(authConfig.redirect.home, { external: true })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ export default defineNuxtPlugin(() => {
|
||||
|
||||
if (stateFromRequest !== stateFromCookie.value) {
|
||||
console.warn('State mismatch', stateFromRequest, stateFromCookie.value)
|
||||
return navigateTo(authConfig.redirect.login)
|
||||
return navigateTo(authConfig.redirect.login, { external: true })
|
||||
}
|
||||
|
||||
const formData = new FormData();
|
||||
@@ -61,13 +61,13 @@ export default defineNuxtPlugin(() => {
|
||||
|
||||
if (!response.ok) {
|
||||
console.warn('Failed to fetch token', response)
|
||||
return navigateTo(authConfig.redirect.login)
|
||||
return navigateTo(authConfig.redirect.login, { external: true })
|
||||
}
|
||||
|
||||
const data: AccessToken = await response.json();
|
||||
await setBearerToken(data.access_token, data.token_type, data.expires_in)
|
||||
await setRefreshToken(data.refresh_token, data.token_type, authConfig.refreshToken.maxAge)
|
||||
return navigateTo(authConfig.redirect.home)
|
||||
return navigateTo(authConfig.redirect.home, { external: true })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ export default defineNuxtPlugin(() => {
|
||||
if (to.path === authConfig.redirect.callback || to.path === authConfig.redirect.callback + '/') {
|
||||
const queryParams = new URLSearchParams(to.query.toString());
|
||||
if (queryParams.has('error')) {
|
||||
return navigateTo(authConfig.redirect.login)
|
||||
return navigateTo(authConfig.redirect.login, { external: true })
|
||||
}
|
||||
|
||||
if (authConfig.responseType === 'token') {
|
||||
@@ -92,7 +92,7 @@ export default defineNuxtPlugin(() => {
|
||||
}
|
||||
|
||||
if (user.value === undefined) {
|
||||
return navigateTo(authConfig.redirect.login)
|
||||
return navigateTo(authConfig.redirect.login, { external: true })
|
||||
}
|
||||
})
|
||||
|
||||
@@ -100,7 +100,7 @@ export default defineNuxtPlugin(() => {
|
||||
const {user, authConfig} = await useAuth()
|
||||
|
||||
if (user.value !== undefined) {
|
||||
return navigateTo(authConfig.redirect.home)
|
||||
return navigateTo(authConfig.redirect.home, { external: true })
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user