wowtrack / feedback

wowtrack.gg feedback repo
https://wowtrack.gg
1 stars 0 forks source link

Unable to log in #27

Closed drunkenvalley closed 1 year ago

drunkenvalley commented 1 year ago

When trying to log in for the first time I am correctly redirected to this page:

image

After clicking Allow I am returned to the wowtrack.gg page, but I'm still not logged in. Subsequent attempts to log in fail - see video. Clearing cache, cookies, etc, and removing the connection to battle.net brings me back to the start, but does not change the outcome.

There is no readily apparent signs of failure - no error logging in console, and no relevant failed requests. There is no evidence a connection failed either, as seen on my battle.net account page.

image

Software:

Video:

https://user-images.githubusercontent.com/1728144/224478615-fc29a5d9-5273-4cab-b3f0-dfc89f03d3c5.mp4

bonesoul commented 1 year ago

related discord issue tracker: https://discord.com/channels/1044608885811597364/1089949575206420520

Hi there @drunkenvalley, thanks for the report.

From your reddit post:

Fwiw, I'm running into some trouble. After an initial attempt to connect my battle.net account I still didn't get signed in after allowing. On subsequent attempts to log in, all the battle.net requests seem to just be redirecting and refreshing my session, but still no change to login.

With adblocker on, it's blocking this script: https://wowtrack.gg/cdn-cgi/zaraz/s.js. Not sure if relevant though. Unblocking did not seem to appreciably change anything.

I went to battle.net to remove my connection, then went back to the site, cleared all cookies, cache, etc, and tried again. It asked me to allow permissions again. I did allow it. Still no change in net outcome.

I'm using Firefox 110.0.1 (64-bit), but I also tried Chrome Version 111.0.5563.65 (Official Build) (64-bit), with no readily apparent differences between the two.

I see this is a next.js project. Would it be a bold guess to think you're using next auth for authentication?

Edit: To try and be comprehensive, [here's a video](https://imgur.com/a/ymMMpVE).

Edit 2: I don't know if it's relevant at all, but I'm a European user.

Edit 3: Created issue on github. https://github.com/wowtrack/feedback/issues/27

First you are correct the site uses next-auth and next.js.

zaraz.js is the provided by Cloudflare Zaraz which actually loads google analytics in web worker. So it should not be related to your issue.

A question though, is this your first time using the site or did you try it before like a week ago? That may cause the issue as a lot in authentication code changed in latest release. You told that you cleared cookies but did you also cleared local storage? If not please clear these all:

image

image

If still issue exists, I'll create a debug build for you that will print all the debug messages regarding authentication and sessions.

drunkenvalley commented 1 year ago

To my knowledge, I have never used the site before today. I cleared the cookies, local storage and session storage. I have retried (after removing permissions from b.net again each time) on both Chrome and Firefox.

bonesoul commented 1 year ago

Okay I'll be pushing the debug build and link it here so you can test it out.

By the way do you see any error in browser console?

drunkenvalley commented 1 year ago

Enabling persisting logs, the only things I see when pressing "Sign in" is this - permissions or not.

❗ Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://stats.g.doubleclick.net/g/collect?t=dc&aip=1&_r=3&v=1&_v=j86&tid=REDACTED&cid=REDACTED&_u=REDACTED&z=REDACTED. (Reason: CORS request did not succeed). Status code: (null).

ℹ Navigated to https://us.battle.net/oauth/authorize?client_id=REDACTED_ID&scope=openid%20wow.profile&response_type=code&redirect_uri=https%3A%2F%2Fwowtrack.gg%2Fapi%2Fauth%2Fcallback%2Fbattlenet&state=REDACTED_STATE

There's a few minor variations for the latter, but it's functionally the same message.

bonesoul commented 1 year ago

@drunkenvalley hi there i created a debug branch for this issue over: https://wowtrack-git-feature-issue-1-int6ware.vercel.app/

Please try loggin it and preserve console log and paste it here so I can check to see root cause of the issue.

drunkenvalley commented 1 year ago

Testing other device

On a whim, I realized I should test an entirely separate device. I appear to have the same issue when trying to log in via my phone. I am starting to suspect there is something fundamentally different to my account that is causing this.

Testing on original device

Looking at a new attempt on the debug branch, this is the full console log with persistent mode enabled.

image

I can toggle on XHR requests to see more info, but unfortunately it's not super helpful.

image

I'm noticing here that this response mentions us.battle.net.

image

The request to next auth session returned is also empty. This may be intentional though, I'm not 100% sure. I'd have to boot up one of my next.js projects and tinker to see if this is meant to be the case.

image

Tangentially, I presume you use next-auth entirely on client-side, but just in case you don't the page props don't mention any user object at all.

image

My pet theory:

Battle.net is correctly responding, but because it's asking for a US account there is no response. I do have a "WoW1 (US) - Starter edition" account on my user, but it could plausibly be blank, because I've never created a character

drunkenvalley commented 1 year ago

Yup, it seems it was trying to fetch my US account, but found no characters. I created one, leveled it up a bit, then tried signing in.

image

Deleting the character and refreshing the page returns me back to the original issue.

Edit: Curiously, you can see in the log there that it fetched the US account's character, but then it also fetched all my EU characters.

Edit 2: I'm able to use my EU characters once battle.net finds a character on my US starter account.

drunkenvalley commented 1 year ago

I asked a friend of mine for good measure. They are another European user who also sees a "WoW1" account, but theirs says "WoW1 (EU) - Starter edition". They have no known characters on this starter account.

They're able to log in just fine, suggesting that the issue is likely related to me having both a US and EU account, with my US account having had no characters to look up.

bonesoul commented 1 year ago

The code checks current character count and if it's zero, it will update the account data from bnet. I think that's the reason it keeps refreshing for you. I'll be implementing a fix.

drunkenvalley commented 1 year ago

Beautiful. Just give me a poke when it's ready and I'll be happy to test it asap.

bonesoul commented 1 year ago

@drunkenvalley i have fixed the issue, can you please check it again over live site https://wowtrack.gg/ and tell me if it worked for you.

drunkenvalley commented 1 year ago

Sorry for the delayed response; it certainly seems to be working now. :)