I believe how you're using the tokens aren't related to redirecting to HTTP. It should be modified from your Nginx and from Laravel APP_URL config.
redirect oauth problems in laravel passport
I am working on an SSO project that leverages Laravel Passport and Laravel UI for authentication. Additionally, I have implemented a separate client project that requests tokens from the server (as outlined in this documentation: https://laravel.com/docs/9.x/passport#requesting-tokens). While authentication works smoothly, I noticed that the OAuth/authorize page does not automatically redirect to SSL when accessed from the client. However, I was able to fix this by modifying the URL to include HTTPS instead of HTTP. To deploy the solution, I used two Nginx proxy passes and Docker. my first nginx conf is:
server {
server_name authtest.example.com;
location / {
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://landings;
proxy_set_header Host authtest.example.com;
}
error_log /var/log/nginx/auth-error.log;
access_log /var/log/nginx/auth-access.log;
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/live/authtest..com/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/live/authtest..com/privkey.pem;
}
and second nginx inside the container is :
server {
server_name authtest.naringames.com;
listen 80; ## listen for ipv4; this line is default and implied
listen 443;
#listen [::]:80 default ipv6only=on; ## listen for ipv6
add_header Access-Control-Allow-Origin *;
#root /usr/share/nginx/html;
root /var/www/auth/public;
index index.php index.html index.htm;
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}
laravel env:
APP_NAME=Laravel
APP_ENV=production
APP_DEBUG=true
APP_URL=http://localhost
I have APP_URL to my domain but nothing changed.
Please or to participate in this conversation.