laravel-5stormpath

Laravel Stormpath Social Login Error


I am using Laravel 5.1 and Stormpath for User management.

I followed this documentation to implement google login

  1. Configuring Your Social Provider = DONE

I created project in Google Console and in “Authorized redirect URIs” I've added
https://{DNS-LABEL}.apps.stormpath.io/authorize/callback

  1. Create a Stormpath Social Directory = DONE
  2. Initiate Social Login - In my form when I click on Google Sign In it redirects to

    https://{DNS-LABEL}.apps.stormpath.io/?response_type=stormpath_token&
    account_store_href=https://api.stormpath.com/v1/directories/{id}
    &redirect_uri=https%3A%2F%2Flocalhost
    

and returns

{"status":404,"message":"Resource not found."}

As per this documentation:

  1. The user clicks on a “Login with Google” link pointing at your application’s /authorize endpoint
  2. Stormpath handles the login to Google and redirects the user back to your app with a Stormpath Token JWT response

What am I doing wrong? Why isn't stormpath redirecting to the google login page?


Solution

  • It looks like the URL that you are creating is missing the /authorize part. If you update your URL to be

    https://{DNS-LABEL}.apps.stormpath.io/authorize?response_type=stormpath_token& account_store_href=https://api.stormpath.com/v1/directories/{id} &redirect_uri=https%3A%2F%2Flocalhost

    It should begin working for you.

    In a future release of the PHP SDK (which powers the laravel integration), we will be able to generate this URL for you.

    If you are using our Stormpath/Laravel integration, the views provided will automatically handle social logic for you. If you are doing this from scratch, it may be worth a look at https://github.com/stormpath/stormpath-laravel

    -Brian