SocialiteProviders / Providers

A Collection of Providers for Laravel Socialite
https://socialiteproviders.com
MIT License
499 stars 438 forks source link

Garmin Connect callback not working #1246

Open Geovanek opened 1 month ago

Geovanek commented 1 month ago

https://socialiteproviders.com/GarminConnect/

I'm trying to implement Garmin Connect in my application, but the callback doesn't happen at all.

In the service config I have:

'garmin-connect' => [
        'client_id'     => env('GARMINCONNECT_CLIENT_ID'),
        'client_secret' => env('GARMINCONNECT_CLIENT_SECRET'),
        'redirect'      => env('GARMINCONNECT_REDIRECT_URI'),
    ],

In .env: GARMINCONNECT_REDIRECT_URI=http://localhost/garmin-callback

Routes:

Route::get('/garmin-redirect', [LoginController::class, 'GarminRedirect'])->name('garmin.redirect');
Route::get('/garmin-callback', [LoginController::class, 'GarminCallback'])->name('garmin.login');

And in controller:

public function GarminRedirect(): RedirectResponse
    {
        /** @phpstan-ignore-next-line */
        return Socialite::driver(ProviderType::GARMIN->value)
            ->redirect();
    }

public function GarminCallback(): RedirectResponse
 {
      dd('It doesn't come here');

      try {
          /** @phpstan-ignore-next-line */
          $userProvider = Socialite::driver(ProviderType::GARMIN->value)->stateless()->user();

          dd($userProvider);
      } catch (Exception $e) {
          return redirect('/')->with('toastr::warning', $e->getMessage());
      }
}

I don't know why it's not working. I have everything set up for Strava too, and it works fine.

After the redirect coming from Garmin authorization, it returns to the home (localhost) with the following url http://localhost/?oauth_token=*****&oauth_verifier=**** But the callback doesn't work.