Comments (10)
@sharmapukar217 That's used to store the token and determine if the user is still authenticated (and refresh their authentication).
There are two alternative storage methods via localStorage
and sessionStorage
that you can utilize as well.
const auth = new SalteAuth({
// ...
storage: 'session', // Every time the browser is closed the user session will be destroyed
storage: 'local' // Retains the user session even when the browser is closed (could still expire ofc)
});
from salte-auth.
By database are you referring to the browser's built-in database IndexedDB
?
If so we never added support for it, unfortunately.
salte-auth
and all of its sub-projects are effectively in maintenance mode at the moment and as such new features aren't really being implemented.
I'll keep this issue open as a way of tracking support regardless however :3
from salte-auth.
I'm not talking about indexed db. Taking reference from next-auth, i was wondering if this is possible or not, or maybe is it good to do so:
See this flow => "User clicks the button and we collect the required data but don't save to cookies, instead we save to our own database (real database on server) and handle all other authentication stuffs like generating session tokens on our own"
from salte-auth.
@sharmapukar217 Ahh!! We don’t have support for server side frameworks which we’re currently tracking over in #546. Best you could do is run the auth client-side and make a request to an api endpoint to save the data, but obviously that’s not ideal.
I’d recommend checking out next-auth if you haven’t already.
from salte-auth.
Duplicate of #546
from salte-auth.
No no.. i don't want to integrate with nextjs or any other framework at all. What I want is instead of saving the credentials to cookie directly, i want to process the data returned from social login and then send it to my auth server and return the user + token.
I have my own authentication system and I just want some helper library to implement the social login.
from salte-auth.
@sharmapukar217 Ahh!! Best you could do is run the auth client-side and make a request to an api endpoint to save the data, but obviously that’s not ideal.
Isn't it good to do so?? This is exactly what i wanted...
from salte-auth.
Sorry about the misunderstanding, I read next-auth
in your comment and for some reason my brain just opted out of reading the next
part of that.
So to clarify, you effectively want to have users login (as an example) with GitHub, Google, etc. and have it all tie back to an individual user in the backend, correct?
If that's the case you can handle it a few different ways. If you're okay with using an existing IDP like Auth0 you could use their service which would tie it all together for you then utilize the login
event to store user info in your database.
Or if you'd rather roll your own solution for cost purposes you could add providers for each of the services you need and hook into the same login
event and tie it all together in the backend using the user's email. That would be the best method off the top of my head.
const auth = new SalteAuth({
providers: [
new Google({
clientID: '<client-id>',
responseType: 'code',
})
]
});
auth.on('login', (error, {provider, data}) => {
// This will output 'google' in this case, but it'll be the name of your provider.
console.log(provider);
// This returns a UserInfo object (https://salte-auth.github.io/interfaces/utils_id_token.idtoken.userinfo.html)
console.log(data);
});
from salte-auth.
Oh ok i think this one will work out for me. Thank you 🙂
from salte-auth.
It will be better i guess if you add an option on config to set cookies or not
from salte-auth.
Related Issues (20)
- An in-range update of http-server is breaking the build 🚨 HOT 1
- An in-range update of @polymer/polymer is breaking the build 🚨 HOT 1
- Find a tool to validate documentation coverage for TypeScript
- Atom auto-complete / intellisense
- Error importing .mjs in Angular (Typescript) HOT 7
- (3.x) Add support for custom parameters HOT 2
- (3.x) Generated API Doc links don't work HOT 6
- (3.x) Improve generated documentation
- invalid_state with redirect login while popup login works with same config HOT 8
- @salte-auth/salte-auth: TypeScript users shouldn't have to validate the Provider type. HOT 4
- Convert Tests to TypeScript
- UserInfo should support non-standard properties HOT 1
- redirectUrl set as RedirectUrl INTERFACE object not working HOT 3
- salte.SalteAuth is not a constructor on Glitch demo HOT 2
- Figure out why SauceLabs refuses to connect
- @salte-auth/salte-auth: Custom `state` parameter
- @salte-auth/popup: Promise should be rejected when popup is closed
- Sveltekit / Server-side Rendering Support HOT 4
- Cannot run yarn successfully HOT 1
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 salte-auth.