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

Garmin Connect callback not working #1246

Open
Geovanek opened this issue Aug 20, 2024 · 0 comments
Open

Garmin Connect callback not working #1246

Geovanek opened this issue Aug 20, 2024 · 0 comments

Comments

@Geovanek
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant