Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable /_auth/local/laravelSanctum/authorize url #117

Open
zerostechnology opened this issue Jun 16, 2024 · 1 comment
Open

How to disable /_auth/local/laravelSanctum/authorize url #117

zerostechnology opened this issue Jun 16, 2024 · 1 comment

Comments

@zerostechnology
Copy link

zerostechnology commented Jun 16, 2024

Environment

  • Operating System: Darwin
  • Node Version: v18.20.3
  • Nuxt Version: 3.11.2
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.6
  • Package Manager: yarn@1.22.22
  • Builder: -
  • User Config: runtimeConfig, modules, build, device, auth
  • Runtime Modules: @nuxt-alt/auth@3.1.6, @pinia/nuxt@0.5.1, @nuxtjs/device@3.1.1, @bootstrap-vue-next/nuxt@0.21.0

Nuxt Config

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
	runtimeConfig: {
		public: {
			appApiURL: process.env.APP_API_URL || 'http://localhost:8000',
			appURL: process.env.APP_URL || 'http://localhost:3000',
			assetURL: process.env.ASSET_URL || 'http://localhost:3000',
			frontURL: process.env.FRONT_URL || 'http://localhost:9000'
		}
	},
	modules: [
		'@nuxt-alt/auth',
		'@pinia/nuxt',
		'@nuxtjs/device',
		// '@nuxtjs/i18n',
		'@bootstrap-vue-next/nuxt'
	],
	build: {
		transpile: ['@vuepic/vue-datepicker']
	},
	device: {
		refreshOnResize: true
	},
	auth: {
		fullPathRedirect: true,
		globalMiddleware: true,
		stores: {
		    pinia: {
		        enabled: true,
		    }
		},
		strategies: {
			'laravelSanctum': {
				provider: 'laravel/sanctum',
				url: process.env.APP_API_URL || 'http://localhost:8000',
				endpoints: {
					csrf: {
						url: '/sanctum/csrf-cookie',
					},
					login: {
						url: '/api/auth/login',
					},
					logout: {
						url: '/api/auth/logout',
					},
					user: {
						url: '/api/auth/user',
						propertyName: '',
					}
				},
				user: {
					property: false,
				},
			},
		}
	},
})

Reproduction

Describe the bug

What is the benefit of /_auth/local/laravelSanctum/authorize ? How can we disable this ?
I got this error and don't have any idea whats wrong
http://localhost:8000/api/auth/login is working fine in postman

Screenshot at Jun 16 22-16-17

Additional context

No response

Logs

[nuxt] [request error] [unhandled] [500] [POST] "http://localhost:8000/api/auth/login": <no response> fetch failed
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)  
  at async AsyncFunction.$fetchRaw2 [as raw] (./node_modules/ofetch/dist/shared/ofetch.37386b05.mjs:231:14)  
  at Object.handler (./.nuxt/local-laravelSanctum.ts:112:20)  
  at async ./node_modules/h3/dist/index.mjs:1962:19  
  at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)  
  at async Server.toNodeHandle (./node_modules/h3/dist/index.mjs:2249:7)
@Fukao0129
Copy link

I also have a same issue.
In my case, /_auth/local/local1/authorize is used when I try to login.
The response is used as the request header of the me API, and it fails.
I want to use my own login API.
How can I disabled authorize API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants