stencila / hub

☸️ Hub for executable documents
https://hub.stenci.la
Apache License 2.0
30 stars 4 forks source link

Look into Account creation sync/issues when using Google OAuth from other apps #426

Open alex-ketch opened 4 years ago

alex-ketch commented 4 years ago

When a user signs up using OAuth from GSuita, a user account is created on the Hub, but not in Intercom.

I have not tried reproducing this issue yet, so cannot confirm that a bug actually exists. A user also tried to sign in to the Hub using the Google Auth button on the hub, but saw an error that their email was already taken. However, it would be nice to carry the user's sign-in status across apps. Not sure how feasible this is though.

alex-ketch commented 3 years ago

@nokome, I can confirm that this is still an issue on the latest deployments.

Steps to reproduce:

Two observations:

Screenshot 2020-10-30 at 10 22 43@2x

First authorization screen

Screenshot 2020-10-30 at 10 11 58@2x copy

Second authorization screen

Screenshot 2020-10-30 at 10 16 21@2x copy
nokome commented 3 years ago

I have made and deployed a fix which should allow for better matching based on email addresses (previously we we not creating an EmailAddress instance for Google users who authenticated with an OpenID token).

However, when a user authenticates with an add-on first, they will still need to authorise the Hub (although now when they do so that authorization should automatically get connected to the first Hub account they created). That is because the Hub and the Apps script add on are separates Outh clients with different ids and secrets:

image

One possible work around for this is for the add-on to send the Hub the Oauth access token and refresh token for each user when they authenticate with the addon?

I am unable to test this at the moment because the add-on is failing to load for me.