websanova / vue-auth

A simple light-weight authentication library for Vue.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spec for implementing API endpoints?

mozboz opened this issue · comments

Seems like I might be missing something in the docs or maybe how the API endpoints are usually setup when using vue-auth, but I'm wanting to implement the API endpoints from scratch (in python with flask) and I can't easily see how to figure out the spec for all the calls vue-auth will make.

There's the list at the top of auth.js but this doesn't specify what those calls will send or expect to receive back for e.g. success/fail.

Thanks! Sorry if this is silly question or not in the right place or I'm completely missing something here about how the backend is usually setup!


Edit: Oh I think I get it now. vue-auth provides only a very thin layer around the API such that all the logic about the definition of the API is created by me in the API and around the vue-auth calls in my Vue pages. vue-auth doesn't actually know anything about e.g. what a login API call contains or if it's successful or not, that's up to me to process when I get the response from the API?

If this is the case it's not clear in the docs e.g. here: https://websanova.com/docs/vue-auth/methods/core#login or here: https://websanova.com/docs/vue-auth/guides/requests how vue-auth knows if the login API call for example was successful? In the demo (v2) that's not explicit in the code anywhere. How does that work - where is the condition defined for vue-auth to know if e.g. login call was successful?

Also for a complete newb a quick example or explanation of tokens somewhere in the docs would be useful. e.g. In this page https://websanova.com/docs/vue-auth/guides/requests it talks about tokens without a reference to where that token comes from in the case that it's e.g. a new login..?

hmm, you're over thinking it, it's just a thin layer above whatever http plugin is being used (axios, vue-resource, etc).

All the questions you are asking can be directed right to the http plugin, for instance how do you know success, etc.

So when you go

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

It's just returning whatever your http plugin would return (Promise for instance).

The rest is mainly boilerplate for passing the token around which is controlled by the drivers...