dusterio / lumen-passport

Making Laravel Passport work with Lumen
MIT License
655 stars 138 forks source link

Nginx environment, access "oauth/token", return to "unsupported_grant_type" #37

Closed bluesdeng closed 7 years ago

bluesdeng commented 7 years ago

Nginx environment, access "oauth/token", return to "unsupported_grant_type"; Apache environment, normal work

desyncr commented 7 years ago

What's your nginx config? Mine looks like:

server {
    listen 80;
    server_name local.dev
    server_name_in_redirect off;

    root /path/to/project/public;
    index index.php;
    location / {
        try_files $uri?$query_string $uri/?$query_string /index.php?$query_string;
    }

    # use fastcgi for all php files
    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
   }
}
bluesdeng commented 7 years ago

My nginx config:

server { charset utf-8; client_max_body_size 128M; listen 80; server_name local.dev; server_name_in_redirect off;

    root  /var/html/ibase-work-apis/public;
    index index.php;

    location ~* \.(eot|otf|ttf|woff)$ {
        add_header Access-Control-Allow-Origin *;
    }

    location / {
        try_files $uri?$query_string $uri/?$query_string /index.php?$query_string;
    }

    location ~ \.php$ {
        include   fastcgi_params;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        try_files $uri =404;
        fastcgi_index index.php;
    }

}

Return result:

{ "error": "unsupported_grant_type", "message": "The authorization grant type is not supported by the authorization server.", "hint": "Check the grant_type parameter" }

bluesdeng commented 7 years ago

I found the problem, and my postman update parameter can not be copied. Sorry, thank you!