0

I'm trying to implement facebook auth using SPA - Angular 6 and backend API - Laravel with Dingo/API.

When I try to redirect and return to SPA the page

public function redirectToProvider() { return Socialite::driver('facebook')->stateless()->redirect()->getTargetUrl(); } 

By some reason response comes from http instead of https according to error.

[blocked] The page at https://www.domain/ was not allowed to display insecure content from http://api.domain/auth/facebook.

Although, I've set up my domains both to be on https and redirect all http requests to https. Moreover, I'm calling https://api.domain/auth/facebook with GET method.

2
  • did you checked your redirect url specified in either your route file or in your developer console of facebook Commented Sep 7, 2018 at 10:48
  • indeed. It also uses https. Moreover, I've specified that is set is up so that http requests are redirected to https Commented Sep 7, 2018 at 12:10

1 Answer 1

0

As I mentioned in another question, there are few ways to make laravel work using https protocol:

  1. Configure your web server to redirect all non-secure requests to https. Example of a nginx config:

    server { listen 80 default_server; listen [::]:80 default_server; server_name example.com www.example.com; return 301 https://example.com$request_uri; } 
  2. Set your environment variable APP_URL using https:

    APP_URL=https://example.com 
  3. Use helper secure_url() (Laravel5.6)

  4. Add following string to AppServiceProvider::boot() method (for version 5.4+):

    \Illuminate\Support\Facades\URL::forceScheme('https'); 
  5. Implicitly setting scheme for route group (Laravel5.6):

    Route::group(['scheme' => 'https'], function () { // Route::get(...)->name(...); }); 
Sign up to request clarification or add additional context in comments.

2 Comments

APp url is set in that way
Also tried to set $api->group([ 'version' => 1, 'middleware' => 'api', 'scheme' => 'https', 'namespace' => $this->namespace, ], still not working

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.