Auth-module: work with sanctum and laravele echo module

Created on 1 May 2020  路  18Comments  路  Source: nuxt-community/auth-module

i have an issue....I can't use auth module with sanctum and laravel echo module...it says $auth.getToken is not o function in console from echo module...I tried some workaround to get token from cookies but still doesn't work.....I get error 419 in laravel echo server csrf token missmatch.....so I don't know what to do...I tried to find a solution on Google and documentation but still nothing...

Most helpful comment

You can add me on discord Joao Pedro AS51#1284

All 18 comments

I don't know if this issue is related with this module or @nuxtjs/laravel-echo module

Hi @radudiaconu0!

it says $auth.getToken is not o function

That's because $auth.getToken was removed in v5. Now we get the token using $auth.token.get()
Laravel echo module need to add support to v5.

Ok thanks I will try to modify this on laravel echo module

I can make a fork and open a PR for v5 support 馃槃

@radudiaconu0 You can use my fork https://github.com/JoaoPedroAS51/laravel-echo/tree/feat/auth-v5

Can you test it? I'm not sure if this solves 419 csrf token mismatch

Hmmm I will try @JoaoPedroAS51

you must introduce referer header @JoaoPedroAS51

yeah didn't solve the issue=(

you must introduce referer header

Are you sure? The plugin is client side only and referer is only need for server side.

if i don't specify refere header onlaravel echoi get error 401 unauthenticated.Otherwise i get "message": "CSRF token mismatch."

@radudiaconu0 Ok. I'll work on this today. I let you know when I finish.

thank dude. in the end someone who want to help me. i posted this in more forums but none cared =( i will treat you with a beer if i ever meet you =)

Thanks! :D
Yeah it sucks when we need help and no one helps...

Ah, can you take a screenshot of the request?

You can add me on discord Joao Pedro AS51#1284

yeah maybe we can fix this together

iget token = 200 if i call $auth.token.get()

I'm having the same CSRF issue, any idea how to fix this?

image

Closing here, as this issue was already solved discussing in discord.

Helpful links: laravel sanctum provider and laravel-echo module for auth v5

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DiegoGallegos4 picture DiegoGallegos4  路  3Comments

yuwacker picture yuwacker  路  3Comments

ishitatsuyuki picture ishitatsuyuki  路  4Comments

essamamdani picture essamamdani  路  3Comments

AhmedAtef07 picture AhmedAtef07  路  3Comments