Git Product home page Git Product logo

Comments (13)

websanova avatar websanova commented on June 17, 2024 1

Just set url option.

$auth.login({
url: 'some/url'
});

https://github.com/websanova/vue-auth/blob/master/README.md#login

On Sep 15, 2016 23:27, "kahwooi" [email protected] wrote:

How can I pass it along the login request?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#22 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABkcy8ui2E86kFTRc1GdAvyfZinONHgXks5qqgytgaJpZM4J9V0Y
.

from vue-auth.

websanova avatar websanova commented on June 17, 2024

Well, it would have to be options.loginData, hut it's beat tondo that in
the init I think

On Sep 14, 2016 19:07, "kahwooi" [email protected] wrote:

Can I set my login API URL using loginData? Is Params the POST body?

login(context, creds, redirect) {
context.$auth.loginData = {url: API_URL + LOGIN_URL, method: 'POST'}
context.$auth.login({
params: {
email: creds.email,
password: creds.password
},
success: function (data) {
localStorage.setItem('esy_token', data.token)
this.user.authenticated = true
},
error: function (err) {
console.log(err)
},
rememberMe: creds.rememberMe,
redirect: redirect
});
},


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#22, or mute the thread
https://github.com/notifications/unsubscribe-auth/ABkcyy7eo4d2MsoJgC_YONRz73ikFKpRks5qqH4qgaJpZM4J9V0Y
.

from vue-auth.

websanova avatar websanova commented on June 17, 2024

Or just pass it I. Along with the login request.

On Sep 14, 2016 20:19, "Robert Duchnik" [email protected] wrote:

Well, it would have to be options.loginData, hut it's beat tondo that in
the init I think

On Sep 14, 2016 19:07, "kahwooi" [email protected] wrote:

Can I set my login API URL using loginData? Is Params the POST body?

login(context, creds, redirect) {
context.$auth.loginData = {url: API_URL + LOGIN_URL, method: 'POST'}
context.$auth.login({
params: {
email: creds.email,
password: creds.password
},
success: function (data) {
localStorage.setItem('esy_token', data.token)
this.user.authenticated = true
},
error: function (err) {
console.log(err)
},
rememberMe: creds.rememberMe,
redirect: redirect
});
},


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#22, or mute the thread
https://github.com/notifications/unsubscribe-auth/ABkcyy7eo4d2MsoJgC_YONRz73ikFKpRks5qqH4qgaJpZM4J9V0Y
.

from vue-auth.

kahwooi avatar kahwooi commented on June 17, 2024

I tried this:

// Vue Auth
Vue.use(VueAuth, {
  router: router,
  rolesVar: 'roles',
  authType: 'bearer',
  tokenHeader: 'Authorization',
  loginData: {url: 'http://ww.sample.co/users/auth', method: 'POST', redirect: '/'}
});

but I got :

GET http://localhost:8080/auth/user 404

from vue-auth.

kahwooi avatar kahwooi commented on June 17, 2024

I also tried this

.$auth.login({
    url: 'http://ww.sample.co/users/auth',
    method: 'POST',
    body: {
        email: creds.email,
        password: creds.password
    },

I still got :

GET http://localhost:8080/auth/user 404

from vue-auth.

websanova avatar websanova commented on June 17, 2024

ok, so there are a few things going on. So the login is separate from the call for fetching the user (since the user is fetched on each init). So you would need to set both url's in the initial config.

Also if you are using vue-resource you could consider setting the http.options.root.

registerData:       {url: 'auth/register',     method: 'POST', redirect: '/login'},
loginData:          {url: 'auth/login',        method: 'POST', redirect: '/'},
logoutData:         {url: 'auth/logout',       method: 'POST', redirect: '/', makeRequest: false},
oauth1Data:         {url: 'auth/login',        method: 'POST'},
fetchData:          {url: 'auth/user',         method: 'GET'},
refreshData:        {url: 'auth/refresh',      method: 'GET'},
loginOtherData:     {url: 'auth/login-other',  method: 'POST', redirect: '/'},
logoutOtherData:    {url: 'auth/logout-other', method: 'POST', redirect: '/admin', makeRequest: false},

There are more, but you can refer to the docs (and let me know if anything is confusing so I can improve it).

from vue-auth.

kahwooi avatar kahwooi commented on June 17, 2024

Got it working.tq.

from vue-auth.

kahwooi avatar kahwooi commented on June 17, 2024

I don't know why every time after a POST, there is a GET request :

POST http://ww.sample.co/users/auth HTTP/1.1 <- correct

GET http://ww.sample.co/auth/user HTTP/1.1 <- don't know why there is a GET request using the wrong URL.

from vue-auth.

websanova avatar websanova commented on June 17, 2024

Well the login is just login. After that it's fetching the user data.

On Sep 16, 2016 21:53, "kahwooi" [email protected] wrote:

I don't know why every time after a POST, there is a GET request :

POST http://ww.sample.co/users/auth HTTP/1.1 <- correct

GET http://ww.sample.co/auth/user HTTP/1.1 <- don't know why there is a
GET request using the wrong URL.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#22 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABkcy-oSQws6gyOK_NWlm60aBWI40xUIks5qq0gYgaJpZM4J9V0Y
.

from vue-auth.

kahwooi avatar kahwooi commented on June 17, 2024

How can I disable it from fetching the user data?

If the login POST is successful, the body will responded with a token in the body, I can save it or future use.

from vue-auth.

websanova avatar websanova commented on June 17, 2024

You can't really, it fetches it after each init for you. Are you sending
back the user data on the login request only?

On Sep 17, 2016 11:55, "kahwooi" [email protected] wrote:

How can I disable it from fetching the user data?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#22 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABkcy9enFsthyAUdG3PZP4kgpyKvMtqIks5qrA1UgaJpZM4J9V0Y
.

from vue-auth.

websanova avatar websanova commented on June 17, 2024

Any updates here, or I can close this?

from vue-auth.

websanova avatar websanova commented on June 17, 2024

Closing due to inactivity.

from vue-auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.