Skip to content
This repository has been archived by the owner on Jun 7, 2019. It is now read-only.

Allow users to connect their social accounts after they have signed up #53

Open
VenkatVenkatesh opened this issue Apr 18, 2019 · 16 comments
Labels
is: epic overview, needs splitting into stories

Comments

@VenkatVenkatesh
Copy link
Contributor

  • Add capability for the users to add their social accounts after they have signed up
  • Show Connect with Twitter and Connect with Github buttons on the cards depending on what account they used to sign up.
  • For e.g., if the user signed up using Github, show the Connect with Twitter button and vice versa
  • So far, we are only doing Github and Twitter
@VenkatVenkatesh
Copy link
Contributor Author

@eddiejaoude Thinking about this feature, Could you please let me know your thoughts on the following scenario?

  1. User signs up with github. We create a user and corresponding socialstats document.
  2. The above user logs out and signs up using another provider like twitter. Now we create user and its corresponding socialstats document.
  3. Now, these two users are independent. In this scenario, if the user tries to connect the github account from his twitter account, should the existing primary github account converted to linked account or should we create a new doc for the linked account?

@SrijithRad
Copy link

@VenkatVenkatesh also note the discussion on #56 (comment) regarding this

@eddiejaoude
Copy link
Contributor

This would be treated like a new account and related docs - I think this would be easier, but please correct me if I am wrong. The easiest option for this.

@VenkatVenkatesh
Copy link
Contributor Author

@eddiejaoude The problem with the above approach is the userId returned by the firebase will be same in both the scenarios. So It will cause duplication of documents. The easiest approach would be converting the primary account to the secondary one if it doesn't have any other accounts connected to it and we should a error prompt if they try adding a primary account that has accounts linked to it as secondary to some other account.

Could you please let me know what's your thought on the above approach ?

@eddiejaoude
Copy link
Contributor

Converting accounts sounds like a lot of work. Can we throw an error page and say this is not your primary account and display them a button to login with for their primary account? Would this be easier?

@VenkatVenkatesh
Copy link
Contributor Author

That's sounds good. Thank you 👍

@eddiejaoude
Copy link
Contributor

No problem 👍

@VenkatVenkatesh
Copy link
Contributor Author

VenkatVenkatesh commented Apr 21, 2019

Hi @eddiejaoude, let me know your thoughts on the below approach

  • Once the user signsUp through their primary account, they can link all their corresponding social apps.(youtube, twitter

  • The primary user account can be identified through a field in userCollection namely

{ 
   isPrimary: true
}

  • For Eg : OnClick of Connect to twitter button the user will be redirected to the twitter consent screen and the corresponding authorization takes place.

  • In the firestore, a new user will be created under userCollection and corresponding userStats, social stats documents.

  • The linked userAccount uid will be added to the primay user documents as

{
  linkedAccounts: {
    twitter: uid,
    youtube: uid
  }
}
  • Using the linkedAccount details the user documents can be fetched.

@eddiejaoude
Copy link
Contributor

eddiejaoude commented Apr 21, 2019

I think it would be easier to store the main userId in the related documents rather than having a join document.

Can you share the whole model structure (in json or ts) so we can make sure we are on the same page. Thanks

@VenkatVenkatesh
Copy link
Contributor Author

Okay @eddiejaoude . Will create and share it.

@VenkatVenkatesh
Copy link
Contributor Author

I think it would be easier to store the main userId in the related documents rather than having a join document.

Can you share the whole model structure (in json or ts) so we can make sure we are on the same page. Thanks

@eddiejaoude We can do like the above approach. but I think there will be increased complexity when handling the following scenario.

If the user logsIn in with github as primary account and links youtube and twitter , the user dashboard will now render the data's of github, youtube and twitter. I have a question here, Could you please let me know if the user is allowed to login through their linked accounts. If yes, then we need to find the primary account details for the linked accounts and also we have to find that whether that primary account has any other linked accounts. I think we have to do two-way join for this scenario. Could you please let me know your thoughts on this ?

@eddiejaoude
Copy link
Contributor

if the user is allowed to login through their linked accounts

The user is not allowed to log in via their linkedin accounts, thats why I think its simpler but if there are other reasons let me know.

We previously discussed in the teams section a structure similar to ...

User {
// ...
   socialConnections: [
      twitter: { ... },
      youtube: { ... }
      // ...
   ]
}

So in the user table we know immediately which is the account they logged in with and which are connected accounts.

May be something has changed? @SrijithRad what do you think?

@VenkatVenkatesh
Copy link
Contributor Author

VenkatVenkatesh commented Apr 21, 2019

That makes sense @eddiejaoude . So to arrive at a conclusion,

  • Users cannot signIn with their linked accounts.

  • Users cannot add a primary account (Twitter) as a linked account to another primary account(Github).

  • There would be a social connections field in user where will have the details of linked accounts.

@eddiejaoude
Copy link
Contributor

Sounds good 👍

@VenkatVenkatesh
Copy link
Contributor Author

Thank you 😄

@SrijithRad
Copy link

Looks good @eddiejaoude

VenkatVenkatesh pushed a commit that referenced this issue Apr 23, 2019
@VenkatVenkatesh VenkatVenkatesh added is: epic overview, needs splitting into stories and removed is: story feature to be done labels Apr 23, 2019
@VenkatVenkatesh VenkatVenkatesh added is: story feature to be done and removed is: epic overview, needs splitting into stories labels Apr 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
is: epic overview, needs splitting into stories
Projects
None yet
Development

No branches or pull requests

3 participants