Reputation: 23
How can I set up authentication and authorization layers with Gun.js the tradicional way, for example with social logins with (Google, LinkedIn) or AWS cognito, Auth0,our my own RBAC server?
Upvotes: 2
Views: 410
Reputation: 7624
Centralized login systems give access tokens to a server and session tokens to the user.
Unfortunately, this means you cannot do fully p2p logins if you want to support other logins, because the server that receives the access token will need to have a "backdoor" into GUN's cryptographic user accounts.
If users are okay with this backdoor...
Then, save their keypair (or generate a secret password) privately to their profile on your existing centralized user account system. Now you can automatically log them into GUN by calling gun.user().auth(keypair)
.
Upvotes: 1