websanova / vue-auth

A simple light-weight authentication library for Vue.js
MIT License
2.36k stars 380 forks source link

The login method saves automatically the token? #174

Closed ecuation closed 7 years ago

ecuation commented 7 years ago

HI,

I'm trying to implement this plugin to my project, at the moment I have some doubts... I use the login method like in the documentation, but the fetch_user action, does not send any Bearer authorization header. Do I have to set it manually? Do I have to save in localStorage with an specific name?

Thanks in advance.

websanova commented 7 years ago

It should be setting automatically. Did you check with using the auth.ready?

On Jun 8, 2017 9:12 PM, "ecuation" notifications@github.com wrote:

HI,

I'm trying to implement this plugin to my project, at the momento I have some doubts... I use the login method like in the documentation, but the fetch_user action, does not send any Bearer authorization header. Do I have to set it automatically?

Thanks in advance.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/websanova/vue-auth/issues/174, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkcy8Vx86OLBic_w3sxBgeOdpTF3x0Wks5sCAErgaJpZM4N0ITw .

ecuation commented 7 years ago

Thanks @websanova for your quick answer,

I've set an if statement in my login method fragment

`if(this.$auth.ready()){ this.$auth.login({ body: { client_id: 2, client_secret: 'gDTj4hNO1ihNQOTtL3qITpRmCZXtpyWqomlP5q6S', username: 'admin@test.com', password: 'secret', grant_type: 'password' }, success: function (response) {

                    },
                    error: function () {
                    },
                    rememberMe: true,
                    redirect: '/user/dashboard',
                    fetchUser: true,
                });
            }`

Is probably bacause I am using Laravel 5.4 passport package?? This is what Laravel response in the oauth request:

screen shot 2017-06-08 at 17 07 03

Do I have to make extra configurations maybe?

Thanks again @websanova!

ecuation commented 7 years ago

Im just checking that the Laravel passport response does not send the data in the headers.

screen shot 2017-06-08 at 17 50 13

There is any way to get the data from the body?

Thanks again!

websanova commented 7 years ago

Seems you need to setup your driver's

On Jun 8, 2017 10:52 PM, "ecuation" notifications@github.com wrote:

I just checking that the Laravel passport response does not send the data in the headers.

[image: screen shot 2017-06-08 at 17 50 13] https://user-images.githubusercontent.com/6634376/26937946-1884018c-4c73-11e7-82d3-7ce226dbf225.png

There is any way to get from the body?

Thanks again!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/websanova/vue-auth/issues/174#issuecomment-307145874, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkcyyJBpmA_OTPR3575ofvkFySXbmgcks5sCBiVgaJpZM4N0ITw .

ecuation commented 7 years ago

Thanks, I set up my own auth driver and now all the things works.

sargilla commented 4 years ago

i have the same problem, where i must set up the driver in passport or in webnova/vue-auth??