fusionauth / fusionauth-php-client Goto Github PK
View Code? Open in Web Editor NEWPHP client library for FusionAuth
Home Page: https://fusionauth.io
License: Apache License 2.0
PHP client library for FusionAuth
Home Page: https://fusionauth.io
License: Apache License 2.0
When there's a read timeout, the response looks something like this:
FusionAuth\ClientResponse::__set_state(array(
'errorResponse' => NULL,
'exception' => NULL,
'method' => 'PATCH',
'request' =>
array (
'user' =>
array (
/* ... */
),
),
'successResponse' => NULL,
'status' => 0,
))
i.e. The errorResponse
, exception
, and successResponse
are all NULL
.
I think the code needs to use curl_errno
to check for errors.
When your fusionauth has 2 tenants, you cant use the library as it misses the appropreate tenantid + appropreate header.
FusionAuthClient class should autoload when used in code.
Autoloading is failing on a case sensitive file system. The declared namespace is fusionauth, but the directory holding the class is FusionAuth. Composer will look for the case sensitive directory fusionauth and will not find it.
Rename the namespace in FusionAuthClient.php from fusionauth to FusionAuth.
It should be ["search" => ["<query/...>" => ""]]
I am working on a passwordless login script. The email to the user works fine. But when the user clicks on the link in the email he gets invalid_redirect_uri (see image)
Here is the uri as it appears in the email:
<a href="http://fusionauth.ngrok.io/oauth2/passwordless/DM4l8LlDvIGzDOcixtjgCMMsFX8-4GqMbsCPGC7k0Cs?tenantId=4272f95b-0989-4892-badc-0ef6b934885f&client_id=f603697d-41ea-4c53-ac2d-e935d5e34221&redirect_uri=35.153.28.164%2Findex.php%2FConfigure%2Freport_generator_amazing&response_type=code&scope=openid&state=bandfrombossanova%40gmail.com" target="_blank" data-saferedirecturl="https://www.google.com/url?q=http://fusionauth.ngrok.io/oauth2/passwordless/DM4l8LlDvIGzDOcixtjgCMMsFX8-4GqMbsCPGC7k0Cs?tenantId%3D4272f95b-0989-4892-badc-0ef6b934885f%26client_id%3Df603697d-41ea-4c53-ac2d-e935d5e34221%26redirect_uri%3D35.153.28.164%252Findex.php%252FConfigure%252Freport_generator_amazing%26response_type%3Dcode%26scope%3Dopenid%26state%3Dbandfrombossanova%2540gmail.com&source=gmail&ust=1619697345074000&usg=AFQjCNFvFntwmztFJBGSbqjC1o8nwwfa9A"> <button style="border:none;color:white;padding:15px 32px;text-align:center;text-decoration:none;font-size:16px;margin:4px 2px;background-color:#008cba"> Click Here to Login! </button> </a>
I am using docker and fusionauth/fusionauth-app:1.19.7.
Is the error message correct? How can I fix this?
The provided PHP login user example does not work for me.
Please assist me to solve it.
He's my code:
$apiKey = "[mykey]";
$client = new FusionAuth\FusionAuthClient($apiKey, "http://localhost:9011/api/login");
$applicationId = "[myid]";
$request = array();
$request["applicationId"] = $applicationId;
$request["email"] = "[email protected]";
$request["password"] = "12345";
$result = $client->login(json_encode($request));
if ($result->wasSuccessful()) {
$user = json_encode($result->successResponse->user);
echo $user;
}else{
$user = json_encode($result->errorResponse);
echo $user;
}
Here is the error I get:
{"fieldErrors":{"applicationId":[{"code":"[couldNotConvert]applicationId","message":"Invalid [applicationId]. This must be a valid UUID String (e.g. 25a872da-bb44-4af8-a43d-e7bcb5351ebc)."}],"loginId":[{"code":"[blank]loginId","message":"You must specify the [loginId] property."}],"password":[{"code":"[blank]password","message":"You must specify the [password] property."}],"userId":[{"code":"[couldNotConvert]userId","message":"Invalid userId on the URL [api]. This must be a valid UUID String (e.g. 25a872da-bb44-4af8-a43d-e7bcb5351ebc)."}]}}
Thanks.
I am having some issues with configuring. From my docker log I am getting:
2021-02-19 6:31:49.102 AM WARN com.inversoft.configuration.BasePropertiesFileInversoftConfiguration - Your FusionAuth configuration file [/usr/local/fusionauth/fusionauth-app/apache-tomcat/../../config/fusionauth.properties] needs attention. Here are the warnings:
2021-02-19 6:31:49.153 AM ERROR com.inversoft.maintenance.db.JDBCURL - Could not parse jdbcString [jdbc:mysql:database-2.cwymdn16cxes.us-east-1.rds.amazonaws.com]
2021-02-19 6:31:49.162 AM ERROR com.inversoft.maintenance.db.DatabaseSilentConfigurationWorkflowTask - Encountered an error while running silent mode
java.lang.IllegalStateException: Invalid database URL [jdbc:mysql:database-2.cwymdn16cxes.us-east-1.rds.amazonaws.com]
I don't know why it is going into silent mode? Where is the config file located? I can't seem to find fusionauth.properties.
I am able to sign in successfully, but fusionAuth isn't signed in. How to sign in with this library and also fusionAuth at the same time? So that all the applications in fusionAuth will auto sign in when the user navigates to any of them.
Currently this library does not support PHP version 8.1.x
This has to do with breaking changes with some deprecations and backward incompatible changes
Versions 8.0.x and below do work without any problems.
For now I can't update my app to 8.1 since it is dependent on this library.
There is an error in RestClient.php file fixed in this pull request : #14
Hi
When sending a request using FA client v1.12 we're getting this message, despite the tenant id being passed and correct:
A Tenant Id is required to complete this request. To complete this request, you may assign a Tenant to your API key, or add the X-FusionAuth-TenantId HTTP request header with the Tenant Id.
The same problem doesn't happen on 1.11 or for any other API calls we use.
I just added a third tenant and i am seeing this:
A 404 status code is returned from the Start Passwordless API when more than one tenant exists in FusionAuth.
This was solved in "Resolves GitHub Issue #833, thanks to @atrauzzi for reporting and helping us track this one down!"
This was reported solve din 1.19.0. I am using 1.19.7 and also experience this (it is repeatable). Can this be?
Please advise.
According to the FusionAuth documentation, there are two ways to remove a user from a group, and both use the URL to pass the request parameters to the FusionAuth API.
Either:
DELETE /api/group/member/{memberId}
or
DELETE /api/group/member?groupId={groupId}&userId={userId}
The method signature for deleteGroupMembers in this library seems designed to accept a JSON request body, but it is not clear how this body should be structured in order to remove a given user from a given group, since the documentation given above does not include removing users from a group using a request body.
I'm trying to do something like this:
$request = [ 'loginId' => $hostData->getUser()->getUsername(), 'sendForgotPasswordEmail' => false ]; $response = $this->client->forgotPassword($request);
but library remove params sendForgotPasswordEmail. I found something like this in code (JSONBodyHandler:427)
$this->body = json_encode(array_filter($bodyObject));
function array_filter without callback remove all empty records from array. In my case remove sendForgotPasswordEmail but it is general problem with this function. It remove values with false and 0.
Calling any method using the JWT authorization should work just fine.
The JWT authorization header is added after the API key authorization header. Curl will only use the first header, thus ignoring the JWT authorization header.
Replace any existing Authorization header when adding a new one.
The composer.json
file is missing a php
version constraint, so it's unclear which versions of PHP are supported by this library.
Please add this information.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.