Getting access_denied error

Hello. I have recently implemented a login with Patreon button. I was following the documentation and this is my implementation. 99% of the time it works just fine. But sometimes some users get access_denied error when calling the oauth2/authorize endpoint.
Here is the code:


Here are the logs for the failing user:

{"headers":{"x-real-ip":"85.193.39.29","host":"facts.cz","connection":"close","x-forwarded-for":"85.193.39.29","x-forwarded-proto":"https","cache-control":"max-age=0","upgrade-insecure-requests":"1","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36","accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","sec-fetch-site":"cross-site","sec-fetch-mode":"navigate","sec-fetch-user":"?1","sec-fetch-dest":"document","sec-ch-ua":"\"Google Chrome\";v=\"137\", \"Chromium\";v=\"137\", \"Not/A)Brand\";v=\"24\"","sec-ch-ua-mobile":"?0","sec-ch-ua-platform":"\"Windows\"","referer":"https://www.patreon.com/","accept-encoding":"gzip, deflate, br, zstd","accept-language":"cs-CZ,cs;q=0.9,en;q=0.8","priority":"u=0, i","cookie":"_ga=GA1.1.2147481940.1747312457; connect.sid=s%3A9cTlEPBl-EJz5_PJkpAYk2KDFKrgLKxH.uTFjcqHWJoT0dO0FcIV7zQHm%2FxqDjDlggIW7nubGGDA; _ga_TM1WQ77BPB=GS2.1.s1748962419$o12$g1$t1748966431$j58$l0$h0"},"method":"GET","url":"/auth/patreon/callback?error=access_denied&error_description=The+resource+owner+or+authorization+server+denied+the+request&state=None","httpVersion":"1.0","body":{},"cookies":{"_ga":"GA1.1.2147481940.1747312457","connect.sid":"s:9cTlEPBl-EJz5_PJkpAYk2KDFKrgLKxH.uTFjcqHWJoT0dO0FcIV7zQHm/xqDjDlggIW7nubGGDA","_ga_TM1WQ77BPB":"GS2.1.s1748962419$o12$g1$t1748966431$j58$l0$h0"},"path":"/auth/patreon/callback","protocol":"http","query":{"error":"access_denied","error_description":"The resource owner or authorization server denied the request","state":"None"},"hostname":"facts.cz","ip":"::ffff:127.0.0.1","originalUrl":"/api/auth/patreon/callback?error=access_denied&error_description=The+resource+owner+or+authorization+server+denied+the+request&state=None","params":{}}