authenticationdistributedgun

Authentication and authorization with Gun.js the tradicional way with Social logins? Gun.io


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?


Solution

  • 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).