mirror of
https://github.com/bitinflow/nuxt-oauth.git
synced 2026-03-13 13:45:59 +00:00
first commit
This commit is contained in:
18
playground/nuxt.config.ts
Normal file
18
playground/nuxt.config.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export default defineNuxtConfig({
|
||||
modules: ['../src/module'],
|
||||
oauth: {
|
||||
redirect: {
|
||||
login: '/login/', // sandbox appends / at the end of url
|
||||
logout: '/',
|
||||
callback: '/login/', // sandbox appends / at the end of url
|
||||
home: '/home'
|
||||
},
|
||||
endpoints: {
|
||||
authorization: 'https://api.sandbox.own3d.pro/v1/oauth/authorization',
|
||||
userInfo: `https://id.stream.tv/api/users/@me`,
|
||||
logout: 'https://id.stream.tv/oauth/token'
|
||||
},
|
||||
clientId: '90a951d1-ea50-4fda-8c4d-275b81f7d219',
|
||||
scope: ['user:read', 'connections']
|
||||
},
|
||||
})
|
||||
4
playground/package.json
Normal file
4
playground/package.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "my-module-playground"
|
||||
}
|
||||
11
playground/pages/guest.vue
Normal file
11
playground/pages/guest.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<template>
|
||||
<div>
|
||||
Guest only page
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
middleware: ["guest"]
|
||||
})
|
||||
</script>
|
||||
20
playground/pages/home.vue
Normal file
20
playground/pages/home.vue
Normal file
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import {useAuth} from "#imports";
|
||||
|
||||
const {user, signOut} = await useAuth();
|
||||
|
||||
definePageMeta({
|
||||
middleware: ["auth"]
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="user">
|
||||
Hello {{ user.name }}
|
||||
|
||||
<button @click="signOut">
|
||||
Sign Out
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
11
playground/pages/index.vue
Normal file
11
playground/pages/index.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<template>
|
||||
<div>
|
||||
Index page
|
||||
<nuxt-link to="/login">
|
||||
Login
|
||||
</nuxt-link>
|
||||
<nuxt-link to="/guest">
|
||||
Guest
|
||||
</nuxt-link>
|
||||
</div>
|
||||
</template>
|
||||
18
playground/pages/login.vue
Normal file
18
playground/pages/login.vue
Normal file
@@ -0,0 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import {definePageMeta, useAuth} from "#imports";
|
||||
|
||||
const {signIn} = await useAuth();
|
||||
|
||||
definePageMeta({
|
||||
middleware: ["auth"]
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<h1>Login</h1>
|
||||
<button @click="signIn">
|
||||
Sign In
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user