Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot log in when selecting the GitLab back-end (sporadically) #739

Closed
munen opened this issue Nov 2, 2021 · 8 comments
Closed

Cannot log in when selecting the GitLab back-end (sporadically) #739

munen opened this issue Nov 2, 2021 · 8 comments
Labels
bug Something isn't working

Comments

@munen
Copy link
Collaborator

munen commented Nov 2, 2021

Describe the bug

@branch14, the co-founder of 200ok.ch, was super happy to hear about the GitLab back-end in organice, so he wanted to use it right away. At first, he could login using Firefox on the Desktop and could log in on his smartphone (Android).

After some time passed, he got an error on organice on the smartphone, so he tried logging back in. Now, logging in on the smartphone reproducibly doesn't work whereas it did work before - and he's still logged in on the Desktop browser.

To Reproduce
Steps to reproduce the behavior:
0. Use @branch14 Android device (yes, this is where the reproducability already stops unfortunately)

  1. Go to https://organice.200ok.ch
  2. Click on 'Sign in'
  3. Select 'GitLab', enter his org repo
  4. See error

Screenshots

Screenshot_20211102_185224_org mozilla fenix

The visible error is generated here: https://github.com/200ok-ch/organice/blob/master/src/actions/sync_backend.js#L69

When inspecting the error by connecting the phone to his Desktop, we see that the issue is not actually 'retrieving the directory', but one step ealier while authenticating against GitLab.

image

image

Smartphone (please complete the following information):

  • Device: Huawei P20 Pro
  • OS: I'm assuming some current Android, don't think/hope that's relevant.
  • Browser: Firefox
@munen munen added the bug Something isn't working label Nov 2, 2021
@munen
Copy link
Collaborator Author

munen commented Nov 2, 2021

@chasecaleb Do you have an idea what this is about?

The only additional context that I can provide that @branch14 can can continue to use organice.200ok.ch on the Desktop and while he is describing the issue, I can continue to log out and in both on the Desktop and my iPhone, so it's likely not a general outage on the side of GitLab.

@chasecaleb
Copy link
Contributor

chasecaleb commented Nov 2, 2021

Ugh, sorry about this! So just to make sure I'm on the same page, there's two scenarios where that token call can happen:

  1. While obtaining the initial token, i.e. clicking "sign in" from https://organice.200ok.ch/sign_in
  2. While using the refresh token to obtain a new access token, i.e. at some random time while using the app (roughly >= 2 hours after sign in)

It sounds like there's an occur occurring for both scenarios, right? Since @branch14 was using the app happy for a while, then scenario 2 caused an occur, then he logged out and attempted to sign in again but encountered scenario 1.


I'm going to do some more digging to figure out why this is going on and I'll get back to you within 12-36 hours, but in the meantime @munen can you post a screenshot of how the OAuth application is configured in GitLab, please? Go to https://gitlab.com/-/profile/applications , then click the edit button (pencil icon) in the "Your applications" section towards the end of the page. For example this is how I have my test application configured:
image

@munen
Copy link
Collaborator Author

munen commented Nov 2, 2021

Ugh, sorry about this!

Not a problem at all. And even if it were, you've responded within 30 minutes from across the world - that's the most expensive SLA I can think of 🚀 🦸

It sounds like there's an occur occurring for both scenarios, right?

This is very much how I understood it while he explained it to me. But @branch14 is the person who can confirm definitively. I can confirm that variant 1 (sign in) is occuring now as I've seen him debug it during a screen sharing session. Since he cannot log in anymore (from the smartphone), it'll be hard to debug variant 2. But I'll make sure to ping him off-channel so he can confirm about the issue in variant 2.

I'm going to do some more digging to figure out why this is going on and I'll get back to you within 12-36 hours

Amazing, thanks 🙇 🙏

@munen can you post a screenshot of how the OAuth application is configured in GitLab, please

Sure, I'm happy to help!

image

@chasecaleb
Copy link
Contributor

@branch14 if you're able to run this for me via remote dev tools and share the output I would appreciate it:

      (() => {
          const state = JSON.parse(localStorage["oauth2authcodepkce-state"]);
          console.log(Object.keys(state));
          console.log(Object.keys(state.accessToken));
          console.log(state.accessToken?.expiry || 'missing');
          console.log(state.hasAuthCodeBeenExchangedForAccessToken);
          console.log(Object.keys(state.refreshToken));
          console.log(localStorage.authenticatedSyncService);
          console.log(window.location.origin);
      })();

Text or screenshot is fine, whichever is more convenient for you.

@branch14
Copy link
Member

branch14 commented Nov 2, 2021

@chasecaleb Thx for looking into this!

organice_gitlab

@branch14
Copy link
Member

branch14 commented Nov 2, 2021

I can confirm that @munen described the issue I have.

Case 2 might have been the initial occurrence of the issue, but I can only reproduce case 1, as I cannot successfully login, atm.

@chasecaleb
Copy link
Contributor

Update: I talked @branch14 on IRC and we found a workaround:

  1. Clear localStorage. He did this via localStorage.clear() from a remote dev tools console, but I'm sure there's easier ways to do it on-device too.
  2. Sign in again

I think the issue occurred because localStorage.authenticatedSyncService was cleared somehow, but so far I'm not sure what bit of code caused that to happen. I'm still looking into the root cause.

@branch14
Copy link
Member

branch14 commented Nov 3, 2021

I had the same issue (case 1 I assume) this morning when I opened organice on my phone.

Looking forward to testing, once #740 is merged and rolled out.

@munen munen closed this as completed in a65eebe Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants