Sending with method POST comes in as method GET with ZF3 Http Client - httpclient

I'm trying to make a POST request with ZF3 Http Client but it comes in as a GET request all the time. I checked the manuals on the zend framework website but I can't find what I'm doing wrong. Probably it will be something small.
My simple script from the client side is:
$request = new Client();
$request->setUri('http://keuringapp.localhost/inspections/pdf/66');
$request->setMethod(Request::METHOD_POST);
$response = $request->send();
die($response->getBody());
on the server side I have this:
$test = $this->getRequest();
print_r($test);exit();
``
and it give met this result:
Zend\Http\PhpEnvironment\Request Object
(
[baseUrl:protected] =>
[basePath:protected] =>
[requestUri:protected] => /nl/inspections/pdf/66
[serverParams:protected] => Zend\Stdlib\Parameters Object
(
[storage:ArrayObject:private] => Array
(
[REDIRECT_APP_ENV] => development
[REDIRECT_STATUS] => 200
[APP_ENV] => development
[HTTP_HOST] => keuringapp.localhost
[HTTP_CONNECTION] => close
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[HTTP_USER_AGENT] => Zend\Http\Client
[PATH] => /usr/bin:/bin:/usr/sbin:/sbin
[SERVER_SIGNATURE] =>
[SERVER_SOFTWARE] => Apache
[SERVER_NAME] => keuringapp.localhost
[SERVER_ADDR] => ::1
[SERVER_PORT] => 80
[REMOTE_ADDR] => ::1
[DOCUMENT_ROOT] => /Applications/MAMP/htdocs/keuringapp/public
[SERVER_ADMIN] => you#example.com
[SCRIPT_FILENAME] => /Applications/MAMP/htdocs/keuringapp/public/index.php
[REMOTE_PORT] => 55447
[REDIRECT_URL] => /nl/inspections/pdf/66
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /nl/inspections/pdf/66
[SCRIPT_NAME] => /index.php
[PHP_SELF] => /index.php
[REQUEST_TIME_FLOAT] => 1562241261.33
[REQUEST_TIME] => 1562241261
[argv] => Array
(
)
[argc] => 0
)
)

This question can be closed. It was a problem due to a language setting in the url

Related

ejabberd and JWT

I've been pounding at this for over a month following these:
https://www.process-one.net/blog/ejabberd-19-08/
https://docs.ejabberd.im/admin/configuration/authentication/#jwt-authentication
I've also been looking at posts like this one:
JWT secret to use with ejabberd?
I've tried decoding the "k" value in the generated jwk to sign the Token. Nothing is currently working. I'm not exactly sure what the log is telling me, for all I know its missing the module responsible for JWT authentication.
my distribution is Garuda:Arch
ejabberd: 21.07-1
I get a crashlog:
2021-10-28 08:45:10.146309-05:00 [error] <0.674.0> ** Generic server <0.674.0> terminating
** Last message in was {'$gen_event',
{xmlstreamelement,
{xmlel,<<"auth">>,
[{<<"xmlns">>,
<<"urn:ietf:params:xml:ns:xmpp-sasl">>},
{<<"mechanism">>,<<"PLAIN">>}],
[{xmlcdata,
<<"AGVyaWMAZXlKaGJHY2lPaUpJVXpJMU5pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SnFhV1FpT2lKbGNtbGpRR3h2ZDJWa2IzZHVMblJySWl3aVpYaHdJam94TmpNMU5ETXdPVEF4ZlEuSUY0LTI4ME9hU1h5Tjl6Yl9jZkZiQk9jWjNEZTMzOV9Xa2JPUkRlbm0tQQ==">>}]}}}
** When Server state == #{mgmt_queue_type => ram,stream_header_sent => true,
mgmt_state => inactive,tls_verify => false,
stream_compressed => false,
stream_timeout => {30000,-576458460293},
mgmt_stanzas_req => 0,
codec_options => [ignore_els],
socket_monitor => #Ref<0.687724880.2890924033.7168>,
user => <<>>,
pres_a => {0,nil},
tls_options => [compression_none],
stream_state => wait_for_sasl_request,
xmlns => <<"jabber:client">>,shaper => c2s_shaper,
tls_required => false,stream_direction => in,
mgmt_max_queue => 5000,csi_state => active,
socket =>
{socket_state,ejabberd_http_ws,
{http_ws,<0.673.0>,
{{0,0,0,0,0,65535,32512,1},52662}},
262144,undefined,none,none},
server => <<"**SECURED.COM**">>,
csi_queue => {0,#{}},
lang => <<"en">>,access => c2s,mod => ejabberd_c2s,
tls_enabled => false,lserver => <<"**SECURED.COM**">>,
owner => <0.674.0>,mgmt_stanzas_in => 0,
stream_authenticated => false,
mgmt_max_timeout => 10800000,
stream_restarted => false,mgmt_ack_timeout => 60000,
zlib => false,resource => <<>>,
mgmt_resend => if_offline,
ip => {{0,0,0,0,0,65535,32512,1},52662},
stream_id => <<"9071053646738984762">>,
mgmt_timeout => 10800000,stream_encrypted => false,
stream_version => {1,0},
mgmt_stanzas_out => 0}
** Reason for termination ==
** {'function not exported',
[{crypto,hmac,
[sha256,
<<229,202,17,249,237,157,59,64,236,115,50,234,213,255,52,31,109,
41,169,46,98,176,188,245,108,155,161,54,88,230,126,175,76,111,
17,186,156,41,53,27,223,122,164,116,89,189,150,4,207,251,152,85,
18,80,49,19,137,243,49,205,5,134,110,182>>,
<<"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqaWQiOiJlcmljQGxvd2Vkb3duLnRrIiwiZXhwIjoxNjM1NDMwOTAxfQ">>],
[]},
{jose_jwk_kty_oct,verify,4,
[{file,"src/jose_jwk_kty_oct.erl"},{line,159}]},
{jose_jws,verify,2,[{file,"src/jose_jws.erl"},{line,379}]},
{jose_jwt,verify,2,[{file,"src/jose_jwt.erl"},{line,189}]},
{ejabberd_auth_jwt,check_jwt_token,3,
[{file,"src/ejabberd_auth_jwt.erl"},{line,117}]},
{ejabberd_auth_jwt,check_password,4,
[{file,"src/ejabberd_auth_jwt.erl"},{line,76}]},
{ejabberd_auth,db_check_password,7,
[{file,"src/ejabberd_auth.erl"},{line,691}]},
{ejabberd_auth,'-check_password_with_authmodule/6-fun-0-',8,
[{file,"src/ejabberd_auth.erl"},{line,248}]}]}
My tokens are manually generated on jwt.io and key file is generated using mkjwk.org.
I'm fully aware that I am probably missing something stupid, but like I previously stated, I've been pounding at this for quite some time, its time to ask for help.

Google Actions: Account linking sends GET request to token URL

I have some problems with the Account Linking for Google Actions:
I have implemented the OAuth2 steps described in the documentation by Google. I have implemented my OAuth2 server and tested it via Postman and am able to get an access token as expected.
If I try to authenticate from the Google Home app by adding the service to my account, I get taken to my authorization form, the authorization works fine and responds with an authorization code to Google's redirect URI as it is supposed to do. However Googles return URI says 'Account linking failed' and then I get a message in the Google Home app : 'Can't update the settings. Check your connection'.
Another strange thing that I've see from my logging of my Token URL script: I can see an incoming GET request from Google to my Token URL instead of a POST request with the required data as mentioned in the Google documentation. So even though the message 'Account linking failed' appears, it seems that Google is calling my token URL, but with a GET instead of a POST.
These are the logs of the requests to the token URL:
REQUEST FROM POSTMAN (testing software) > OK
__SERVER
Array
(
[USER] => www-data
[HOME] => /var/www
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[HTTP_ACCEPT] => */*
[HTTP_USER_AGENT] => PostmanRuntime/7.6.1
[HTTP_POSTMAN_TOKEN] => f85664e2-7d38-4511-9519-cddda3feec06
[HTTP_CACHE_CONTROL] => no-cache
[HTTP_CONTENT_TYPE] => application/x-www-form-urlencoded
[HTTP_CONTENT_LENGTH] => 145
[HTTP_CONNECTION] => close
[HTTP_HOST] => 127.0.0.1
[REDIRECT_STATUS] => 200
[SERVER_NAME] => _
[SERVER_PORT] => 80
[SERVER_ADDR] => 127.0.0.1
[REMOTE_PORT] => 38622
[REMOTE_ADDR] => 127.0.0.1
[SERVER_SOFTWARE] => nginx/1.12.2
[GATEWAY_INTERFACE] => CGI/1.1
[REQUEST_SCHEME] => http
[SERVER_PROTOCOL] => HTTP/1.0
[DOCUMENT_ROOT] => [******]
[DOCUMENT_URI] => /google/token/index.php
[REQUEST_URI] => /google/token/
[SCRIPT_NAME] => /google/token/index.php
[CONTENT_LENGTH] => 145
[CONTENT_TYPE] => application/x-www-form-urlencoded
[REQUEST_METHOD] => POST
[QUERY_STRING] =>
[SCRIPT_FILENAME] => [******]
[FCGI_ROLE] => RESPONDER
[PHP_SELF] => /google/token/index.php
[REQUEST_TIME_FLOAT] => 1553765980.9273
[REQUEST_TIME] => 1553765980
)
__POST
Array
(
[client_id] => [******]
[client_secret] => [******]
[grant_type] => authorization_code
[code] => [******]
)
REQUEST RECEIVED WHEN TESTING WITH GOOGLE HOME APP on smartphone > NOT OK
__SERVER
Array
(
[USER] => www-data
[HOME] => /var/www
[HTTP_ACCEPT_ENCODING] => gzip,deflate,br
[HTTP_USER_AGENT] => OpenAuth
[HTTP_CONTENT_TYPE] => application/x-www-form-urlencoded
[HTTP_CONNECTION] => close
[HTTP_HOST] => 127.0.0.1
[REDIRECT_STATUS] => 200
[SERVER_NAME] => _
[SERVER_PORT] => 80
[SERVER_ADDR] => 127.0.0.1
[REMOTE_PORT] => 46184
[REMOTE_ADDR] => 127.0.0.1
[SERVER_SOFTWARE] => nginx/1.12.2
[GATEWAY_INTERFACE] => CGI/1.1
[REQUEST_SCHEME] => http
[SERVER_PROTOCOL] => HTTP/1.0
[DOCUMENT_ROOT] => [******]
[DOCUMENT_URI] => /google/token/index.php
[REQUEST_URI] => /google/token/
[SCRIPT_NAME] => /google/token/index.php
[CONTENT_LENGTH] =>
[CONTENT_TYPE] => application/x-www-form-urlencoded
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[SCRIPT_FILENAME] => [******]
[FCGI_ROLE] => RESPONDER
[PHP_SELF] => /google/token/index.php
[REQUEST_TIME_FLOAT] => 1553767309.7797
[REQUEST_TIME] => 1553767309
)
__REQUEST
Array
(
)
__POST
Array
(
)
__GET
Array
(
)
-------------------------
__ANSWER
400: invalid grant
Configuration in Actions Console
Problem seemed to be caused by the redirect of / to /index.php without the POST values.
Fixed it by changing my URLs in the Actions Console to /index.php and now the linking works fine.

How to modify Mediawiki Login form

I'm trying to add the attribute autocomplete="off" in mediawiki login form. Being completely new, I'm unable to find where the form is being built.
I'm using MediaWiki 1.29.1
Any help would be greatly appreciated.
Things I did to find it:
1. Added the following code in LocalSettings.php
$wgHooks['UserLoginForm'][] = 'modifyLoginForm';
function modifyLoginForm( &$template ) {
//Printed template and got the following
/*
UserloginTemplate Object
(
[data] => Array
(
[link] =>
[header] =>
[name] => Admin
[password] =>
[retype] =>
[email] =>
[realname] =>
[domain] =>
[reason] =>
[action] => /mediawiki/index.php?title=Special:UserLogin&action=submitlogin&type=login&returnto=Main+Page
[message] =>
[messagetype] => error
[createemail] =>
[userealname] => 1
[useemail] => 1
[emailrequired] =>
[emailothers] => 1
[canreset] => 1
[resetlink] => 1
[canremember] => 1
[usereason] =>
[remember] =>
[cansecurelogin] =>
[stickHTTPS] =>
[token] => 18955182baa69e0a66edefghi4e0ef
[loginend] =>
[signupend] =>
[usedomain] =>
)
*/
}
Tried to modify includes/templates/Userlogin.php . There is a login form, but it didn't get affected.
Checked LoginSignupSpecialPage.php, but not sure how to add the attribute.

Yii2 Facebook Login issue: Error Validating Client Secret

I'm trying to activate Login via Facebook on my website that is built using Yii2 framework, but the Login is always failing, although the facebook app is authorizing the facebook account used in the login.
The response is always this error:
Request failed with code: 400, message: Error validating client
secret.
Im using yii2's authclient:
return [
'class' => 'yii\authclient\Collection',
'clients' => [
'facebook' => [
'class' => 'yii\authclient\clients\Facebook',
'authUrl' => 'facebook.com/dialog/oauth',
//Prod
'clientId' => 'appidhere',
'clientSecret' => 'appsecrethere',
'scope' => 'email, user_friends, public_profile',
.....
The app id and app secret are correct, and the fb app settings are correct as well.
Here's what the request looks like:
yii\httpclient\Request Object ( [_url:yii\httpclient\Request:private]
=> graph.facebook.com/oauth/access_token [_fullUrl:yii\httpclient\Request:private] =>
[_method:yii\httpclient\Request:private] => POST
[_options:yii\httpclient\Request:private] => Array ( [userAgent] => My
Application OAuth 2.0 Client [timeout] => 30 [sslVerifyPeer] => )
[isPrepared:yii\httpclient\Request:private] => [client] =>
yii\httpclient\Client Object ( [baseUrl] => graph.facebook.com
[formatters] => Array ( ) [parsers] => Array ( ) [requestConfig] =>
Array ( ) [responseConfig] => Array ( ) [contentLoggingMaxSize] =>
2000 [_transport:yii\httpclient\Client:private] =>
yii\httpclient\StreamTransport [_events:yii\base\Component:private] =>
Array ( ) [_behaviors:yii\base\Component:private] => )
[_headers:yii\httpclient\Message:private] =>
[_cookies:yii\httpclient\Message:private] =>
[_content:yii\httpclient\Message:private] =>
[_data:yii\httpclient\Message:private] => Array ( [client_id] =>
realappidhere [client_secret] => ​realappsecrethere [code] =>
AQAr0KRC0m4V4lqD8LVcQLNjn76xkZS4skQYAvWf6O_DDeEclaj1LMQm_HoyCoZZezqDn7p9YfJm3qENabU8MKvmH1ffNJotMzgLW2XTbSqQEXlkg_sx7V-ibXRFagpfXTIqCp9Kr54O88bNYGikoOr4TM1ogGjViwS-qKLbvpR_vWgE_FPy9ecpgy86QOITpGrlVJaPAun2bzGaFXmU70Z4Kw3kBWUBPseWc_7ILGymZP-CIbRIIm_YZ8p7t9Vo7jZmieMSd-CMYfG0sgJcBjOgQNvsa3xtHNhPVa5BJNNTy89zulSpTAf3XB6HB_8eql0
[grant_type] => authorization_code [redirect_uri] =>
example.com/site/auth?role=influencer&authclient=facebook )
[_format:yii\httpclient\Message:private] =>
[_events:yii\base\Component:private] => Array ( )
[_behaviors:yii\base\Component:private] => )
And the response is:
yii\httpclient\Response Object ( [client] => yii\httpclient\Client
Object ( [baseUrl] => graph.facebook.com [formatters] => Array
( [urlencoded] => yii\httpclient\UrlEncodedFormatter Object (
[encodingType] => 1 [charset] => ) ) [parsers] => Array ( )
[requestConfig] => Array ( ) [responseConfig] => Array ( )
[contentLoggingMaxSize] => 2000
[_transport:yii\httpclient\Client:private] =>
yii\httpclient\StreamTransport Object (
[_events:yii\base\Component:private] => Array ( )
[_behaviors:yii\base\Component:private] => )
[_events:yii\base\Component:private] => Array ( )
[_behaviors:yii\base\Component:private] => Array ( ) )
[_headers:yii\httpclient\Message:private] => Array ( [0] => HTTP/1.1
400 Bad Request [1] => WWW-Authenticate: OAuth "Facebook Platform"
"invalid_request" "Error validating client secret." [2] =>
Access-Control-Allow-Origin: * [3] => Pragma: no-cache [4] =>
Cache-Control: no-store [5] => facebook-api-version: v2.2 [6] =>
Expires: Sat, 01 Jan 2000 00:00:00 GMT [7] => Content-Type:
text/javascript; charset=UTF-8 [8] => x-fb-trace-id: Ek0PFIJ3B3N [9]
=> x-fb-rev: 2718923 [10] => Vary: Accept-Encoding [11] => X-FB-Debug: yaiIHJkwC4T3UZKrzXOJGJ2DmCTaDr8nIRB3jQnNeEiknx0Ph7i2IR5XmAbxpjM7cBhSEy44AcrglCYEdZEmeg==
[12] => Date: Sun, 04 Dec 2016 11:08:16 GMT [13] => Connection: close
[14] => Content-Length: 115 )
[_cookies:yii\httpclient\Message:private] =>
[_content:yii\httpclient\Message:private] =>
> {"error":{"message":"Error validating client
secret.","type":"OAuthException","code":1,"fbtrace_id":"Ek0PFIJ3B3N"}}
[_data:yii\httpclient\Message:private] =>
[_format:yii\httpclient\Message:private] =>
[_events:yii\base\Component:private] => Array ( )
[_behaviors:yii\base\Component:private] => )
So any idea what's happening in there?
Note: I removed the http and https from the facebook links in the quotes because stackoverflow wouldn't let me post more than 2 links.
Try using Yii2 EAuth extension. This is the best extention which provides social login over 14 diff platforms with the easiest way.
reference url:
https://github.com/Nodge/yii2-eauth
demo url : http://nodge.ru/yii-eauth/demo2/login

zend framework action name changes to 'id'

I have a zend framework application with modules 'dashboard' and 'admin' of which 'dashboard' is the default one. When I try to access a different module, I am getting the request object like this
Zend_Controller_Request_Http Object
(
[_paramSources:protected] => Array
(
[0] => _GET
[1] => _POST
)
[_requestUri:protected] => /admin/application/show/
[_baseUrl:protected] => http://local.dashmonitor.us.com
[_basePath:protected] =>
[_pathInfo:protected] => /admin/application/show/
[_params:protected] => Array
(
[module] => admin
[controller] => application
[action] => get
[id] => show
)
[_rawBody:protected] =>
[_aliases:protected] => Array
(
)
[_dispatched:protected] => 1
[_module:protected] => admin
[_moduleKey:protected] => module
[_controller:protected] => application
[_controllerKey:protected] => controller
[_action:protected] => get
[_actionKey:protected] => action
)
My real action name is 'show' but it changes to 'get' here. Can anybody please help?