#Laravel socialite "Too many requests" callback error

10 messages · Page 1 of 1 (latest)

spiral oracle
#

Hi I am trying to integrated 3rd party login such as WHMCS but I get "Too many request" callback error when I get the account authorized. What is the cause of this issue and its remedy?

#

This is my custom AuthController which handles my 3rd party login

public function oauthCallback(string $provider): JsonResponse
    {
        try {
            $user = Socialite::driver($provider)->user();

            $user = DB::connection('whmcs')
                ->table('tblaffiliates_data')
                ->where('clientid', $user->id ?? 0)
                ->where('categories', '!=', '[]')
                ->where('archived', 0)
                ->first();

            return new JsonResponse([
                'item' => 'userlogged-in',
                'user' => $user
            ]);
        } catch (Exception $e) {
            dd($e);

            return Redirect::route('auth.login', ['oauth=failed']);
        }

I tried to add dd() above the $user variable however it doesn't seem to get passed even the `dd() function

#

This is what handles my oauthRedirect

   public function oauthRedirect(string $provider): JsonResponse
    {
        return new JsonResponse(['redirect' => Socialite::with('whmcs')->setScopes(['openid', 'email', 'profile'])->redirect()->getTargetUrl()]);
    }
#

Note I get redirected but after I authorized the account it will display "Too many requests" error

scarlet geyser
#

I don't know what whmcs is, but it sounds like you're getting rate limited. Check their documentation.

spiral oracle
#

Btw I also edited out the kernel and remove ratelimiter

#

I am using "auth" middlewareGroup

covert cave
#

Are you sure you're not causing an infinite redirect which is then being throttled? You can use the network tab in your browser's devtools to see the requests (you might have to enable "preserve log"), then you could see what's happening