firebase / firebase-js-sdk

Firebase Javascript SDK
https://firebase.google.com/docs/web/setup
Other
4.86k stars 894 forks source link

"Create index" link doesn't support multiple accounts #5227

Closed charles-allen closed 6 months ago

charles-allen commented 3 years ago

Describe your environment

Describe the problem

Suggested solution

  1. Enumerate all logged in users until finding one with access
  2. If none have access, redirect to login

Steps to reproduce

  1. Create a Node project under a secondary user (not default in your browser)
  2. Write a query that requires an index
  3. Click the "create index" link in the error message

Expected: Opens Firebase Console as the correct user and suggest the index

Screen Shot 2021-08-01 at 14 02 55

Actual: Opens Google Cloud Console as the default user and state that you don't have access

Screen Shot 2021-08-01 at 14 03 19

Additional: When I changed user in Google Cloud Console, I was redirected to a GCP Console Firestore page, but for a completely different project (which I consider highly confusing and potentially dangerous)

Screen Shot 2021-08-01 at 14 03 36

Temporary Workaround

Usually I resolve such issues be adding /u/2 at the start of the URL. In this instance, I also needed to remove /v1/r (which I assume is a redirect to support future-proofing). Note: I was only able to find the correct URL after adding my primary account to the project.

google-oss-bot commented 3 years ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

looptheloop88 commented 3 years ago

Hi @charles-allen, thanks for the report. I am trying to replicate the behavior that you've reported. I'm not sure what you really mean by the "secondary user (not default in your browser)" part. Do I need to log multiple accounts in the Firebase console? Open the link to create a Firestore index, then switch to a different user? Also, should the secondary user need to be a member of the Firebase project?

charles-allen commented 3 years ago

Hi @charles-allen, thanks for the report. I am trying to replicate the behavior that you've reported. I'm not sure what you really mean by the "secondary user (not default in your browser)" part. Do I need to log multiple accounts in the Firebase console? Open the link to create a Firestore index, then switch to a different user? Also, should the secondary user need to be a member of the Firebase project?

  1. In your browser, login to Firebase Console (which is actually logging into all of Google) with multiple users (I mean the account switcher that you get when you click your profile icon). The first account you logged in with is labelled your "default account".
  2. Create a Firebase project under any non-default account
  3. Try to use the error link to create an index for that project

Result: the link opens a page that is logged in with your default account, not the account that has access to the Firebase project.

charles-allen commented 3 years ago

Look at the top-right of my screenshots. Notice that the profile icon is different.

My Firebase project is under "suit/tie" account. But the link opens a page that's logged in with my default "hat/hoodie" account.

charles-allen commented 3 years ago

Once logged in with multiple users, all URLs are updated to include the user index, ex:

The "create index" URL does not include this.

looptheloop88 commented 3 years ago

Hi @charles-allen, thanks for the detailed explanation. I was able to reproduce the behavior now. Let me check what we can do for this issue or bring someone here that can provide more context about it. I’ll update this thread if I have any information to share.

wu-hui commented 3 years ago

Hey @charles-allen

Thanks for the report..our console team is able to reproduce this, and will try to address this by allowing you to pick which user profile to use. We are tracking this feature internally..and unfortunately there is no ETA at this point.

Will keep you updated when I hear more!

looptheloop88 commented 3 years ago

Here's the internal bug for reference: b/195421452

charles-allen commented 3 years ago

I noticed the same effect this morning when clicking a link in a Firebase email (ie. this might be a much broader architectural issue). Again, the redirect assumes my default Google user (which seems ironic since I viewed the email in Gmail, while logged in as the secondary account).

Screen Shot 2021-08-17 at 11 51 15

TobiasHeidingsfeld commented 6 months ago

Issue still existing and no changes after 3 years?

MarkDuckworth commented 6 months ago

It looks like this issue with the create index link was fixed in the console in March of 2022. I just verified that it is still behaving correctly. This GitHub ticket should have been closed.

@TobiasHeidingsfeld, can you tell us more about what you are experiencing?

TobiasHeidingsfeld commented 6 months ago

The same as the other reports above. Links to create a compound index are not including the the user e.g. /u/1 in the url so they fail even if my flutter CLI uses the correct user.

MarkDuckworth commented 6 months ago

I'm testing with the latest firebase-js-sdk, and when I'm logged into multiple Google accounts and then open the link to create an index (the link logged by the firebase-js-sdk), then I am prompted to choose the account. See the screenshot.

image

If I'm only logged into a single Google account, then I'm not prompted to choose the user when opening the link.

Can you provide more information about the SDK platform and version you are using? If you have detailed steps to reproduce, that would be helpful.

MarkDuckworth commented 6 months ago

I'm closing this because it looks like the issue was addressed in the Firebase console in March of 2022. I verified that when the user is logged into multiple Google accounts, then the console will prompt the user to select an account when opening a create index link.

If any customers are still experiencing this or related issues, please let us know. Googlers follow b/195421452.