keratin / authn-server

Authentication service that keeps you in control without forcing you to be an expert in web security.
https://keratin.github.io
GNU Lesser General Public License v3.0
1.27k stars 110 forks source link

Oauth: Unlink social account from main authn account #252

Closed diegosperes closed 6 months ago

diegosperes commented 7 months ago

Authn offers a feature that enables users to connect their accounts with their social media profiles. However, this has created a need for a feature that allows users to disconnect their social media accounts. The current issue is to develop a way in Authn that enables users to unlink social media account.

Proposed Solution:

Create a new HTTP DELETE endpoint to unlink the user's current session from their social media accounts. This endpoint will be public. The frontend needs to adhere to the following contract:

DELETE /oauth/provider

In that case provider can be one of the supported oauth providers like; google

AlexCuse commented 7 months ago

This is a good idea. A few considerations that come to mind -

diegosperes commented 7 months ago

@AlexCuse Thanks for your comments.

I've submitted a PR that implements the unlink feature, taking into account all your suggestions during development.

To address your queries:

Regarding whether we need to support any revocation with the provider(s) or if it's sufficient to just "forget" the user's OAuth account, my tests indicate that simply "forgetting" the user's OAuth account allows the user to reenter the OAuth flow without any issues.

As for the scenario where a user revokes access through the provider and how to handle re-linking in that case, this is already implemented. The user simply needs to give consent again to use social login.