Comments (13)
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.
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.
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 thinkOn 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.
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.
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.
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-resourc
e 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.
Got it working.tq.
from vue-auth.
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.
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.
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.
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.
Any updates here, or I can close this?
from vue-auth.
Closing due to inactivity.
from vue-auth.
Related Issues (20)
- Built in cookie store broken in latest version? HOT 4
- Vue 3 Typescript not working, types missing HOT 1
- Integrate vue-auth with Keycloak HOT 1
- [Question] Authenticating users from external apps HOT 2
- How to set token expiration as refreshData interval HOT 1
- Vue3 Demo - Could not resolve dependency vue@"^3.2.0" from [email protected] HOT 2
- Handling MFA HOT 1
- Support pinia for vue 3 HOT 8
- How to extend Auth using v3 createAuth HOT 4
- This package is not working on VUE 3 + Vite
- token doesn't persist, suggested behavior vs Oauth 2.0 RFC spec? HOT 2
- Vue-Auth and Pinia HOT 10
- Vue 3 rolesKey option not supporting dot notation HOT 3
- redirect to page if i get 503 error HOT 2
- Storing multiple user credentials HOT 1
- Handling multiple roles from different keys HOT 2
- Redirect : Erreur 401 on apache server and not a local wamp HOT 4
- Package not working with Vue.js 3.3 and Vite HOT 1
- Missing Typescript definition for named route params
- Logout request executes after auth reset
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-auth.