Category : nuxt.js

I added sanctum:auth middleware to the /graphql route in laravel. I keep getting 401 Unauthenticated on this route. I followed the steps in sanctum SPA authentification guide Everything works without that middleware on the route, but I don’t want to leave the api exposed without authentification. I tried with ssr=true and ssr=false nothing works. docker-compose.yaml ..

Read more

I host my code on digitalocean Frontend use Nuxt js and Backend use Laravel I test api using postman backend api ok Error: strict-origin-when-cross-origin modules: [ // https://go.nuxtjs.dev/axios ‘@nuxtjs/axios’, ‘@nuxtjs/sitemap’, ‘@nuxtjs/proxy’, ], axios: { proxy: true, prefix: ‘http://api.mydomain.com/api’ }, proxy: { ‘/api/’: ‘http://api.mydomain.com/api’, }, Sourc..

Read more

I tried to sent api request from Nuxt to Laravel. On my nuxt i have axios configured like this: export default function({$axios, store}, inject){ var base_url = "http://api-test.test/api"; inject(‘api’, function(){ const axios_api = $axios.create() axios_api.setBaseURL(base_url); axios_api.setHeader(‘Accept’, ‘application/json’, ‘common’); axios_api.setHeader(‘Content-type’, ‘application/json’, ‘common’); return axios_api; }); } And my post request is : var formData = new ..

Read more

I made an app with laravel and nuxt. I deployed it to server with nginx. My nginx code is like this server { listen 80; root /home/anjaan/desijewel/api/public; index index.php index.html index.htm index.nginx-debian.html; server_name 206.189.142.151; location /api { try_files $uri $uri/ /index.php?$query_string; } location / { // Reverse proxy code from nuxtjs.org } location ~ .php$ ..

Read more

I want to return the scopes base on user role when nuxt auth requesting token in default localhost:3000/_auth/laravelPassport/token. here’s the nuxt.config.js auth strategy setup strategies: { laravelPassportPasswordGrant: { name: ‘laravelPassport’, provider: ‘laravel/passport’, url: process.env.API_URL, endpoints: { logout: ‘/api/auth/logout’, user: { url: ‘/api/auth/user’, }, }, clientId: process.env.PASSPORT_CLIENT_ID, clientSecret: process.env.PASSPORT_CLIENT_SECRET, grantType: ‘password’, }, }, My Laravel boot ..

Read more

I noticed that every time I make a request to the server, I constantly receive a new cookie with the current CSRF token. At the same time, I can definitely say that I am not doing anything with cookies in these requests. Responses for requests: https://imgur.com/a/CHCXNZf Laravel project configs: https://imgur.com/a/RDfWqmQ Nuxt.js project (SPA) code and ..

Read more

I have finished my laravel, nuxt(ssr,server) project and deployed them separate subdomains like api.example.com && beta.example.com. In sake of user login when i add axios.defaults.withCredentials = true to resources/js/bootstrap.js file in laravel, all the api get/post requests become so slow or even request throws timeout, but when I directly connect to api url like https://api.example.com/api/v1/categories ..

Read more

Please advise what exactly I should write instead of this phrase? To display receive user information from the database? after logging in //ProfileDropDown.vue <template> <div class=”text-right leading-tight hidden sm:block”> <p class=”font-semibold”>{{ activeUserInfo.displayName }}</p> <small>Available</small> </div> </template> <script> export default { data () { return { activeUserInfo: null } }, methods: { async getUserInfo () { ..

Read more

i’m new with nuxt and i want to use nuxt auth, this my configuration in nuxt.config.js: auth: { strategies: { local: { token: { property: ‘data.success.data.access_token’, type: ‘Bearer’ }, user: { property: ‘data.success.data.user’, autoFetch: true }, endpoints: { login: {url: process.env.BASE_URL_API + ‘/authentication’, method: ‘post’}, logout: { url: process.env.BASE_URL_API + ‘/_revoke’, method: ‘post’ }, user: ..

Read more

I have installed: laravel v 7.30.4 nuxtjs v 2.15.7 After i login in my laravel sanctum with nuxtjs auth module, when nuxt try to get user, laravel response 401 error(Unauthenticated message). My network status: My cookies status: api.php: Route::group([‘middleware’=>’auth:sanctum’], function (){ Route::get(‘/user’, function (Request $request){ return $request->user(); }); }); nuxt.config.js : auth:{ strategies: { ‘laravelSanctum’: ..

Read more