Login, Register problem in laravel 8 Cpanel - laravel

The route is https://test.iqbal.live/api/auth/login/
field: username , password
enter image description here
In local environment its fine, when i upload it cpanel give the error below:
{
"message": "The GET method is not supported for this route. Supported methods: POST.",
"exception": "Symfony\\Component\\HttpKernel\\Exception\\MethodNotAllowedHttpException",
}

Try with postman ... its working...

Related

Laravel 8 Socialite check login

is there a way to check if the user has logged in with a Socialite?
because i want to create a post based on this authentication.
what i have done
if (!empty(Socialite::driver('linkedin')->stateless()->user()))
{
$linkedinuser = Socialite::driver('linkedin')->stateless()->user();
dd($linkedinuser);
}
return redirect('/profile/');
i expect to get the dump if user has authenticated with linkedin, or else return profile. Instead, i get an error
GuzzleHttp\Exception\ClientException
Client error: `POST https://www.linkedin.com/oauth/v2/accessToken` resulted in a `400 Bad Request` response: {"error":"invalid_request","error_description":"A required parameter \"code\" is missing"}
how can this be checked ? thanks.

Use Laravel Socialite user returns missing authorization_code

I'm using Laravel Socialite to login with SuperOffice API. Have only just added the provider as a pr but testing it already. I'm using the provider superoffice locally and inside a package superoffice-api I'm creating. Have added both packages to composer.json in the Laravel app:
"repositories": [
{
"type": "path",
"url": "./packages/superoffice-api"
},
{
"type": "path",
"url": "./packages/superoffice"
}
]
Also added the superoffice Socialite provider in the superoffice-api composer.json in the same way.
The login process is working but the problem starts when trying to use the user for other API calls. What I mean with this is on the callback I can do the following:
public function superofficeCallback(Request $request): RedirectResponse
{
$user = Socialite::driver('superoffice')->stateless()->user();
return redirect()->route('dashboard.index')->with([
'message' => 'Loggedin with SuperOffice as '.$user->name,
'success' => true,
]);
}
This shows the $user->name as expected. Now when trying to call Socialite::driver('superoffice')->stateless()->user() in the superoffice-api package I get the following error message:
GuzzleHttp\Exception\ClientException: Client error: POST https://sod.superoffice.com/login/common/oauth/tokens resulted in a 400 Bad Request response:
{ "error": "invalid_request", "error_description": "missing authorization_code"}
It doesn't matter if called in a method or in the __construct() of a class.
So my question is how can I use a Socialite provider superoffice user in a package superoffice-api? This is needed to get the access_token. Can imagine that because Socialite is called in a package some sort of reference is missing.
The problem here is that the access_token and refresh_token need to be stored in some other way in the callback function. When stored for example in the database you're able to use the tokens anywhere.

How to set a base url in a springboot graphql app

How can we set a base url in springboot graphql-server app .
By default the graphiql api-console opens on http://localhost:8080/graphiql
Trying to access http://localhost:8080 through postman with a post -query as below :
{
bookings {
name
}
}
gives an error saying :
{
"timestamp": 1549913598497,
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/"
}
Q1 what should be the path to the server i should be using to invoke it.
Q2 is there a way to provide a custom base path something loke http://localhost:8080/service/api/query
Usually the server path for graphql endpoints is at http://localhost:8080/graphql. If not just inspect the network tab on your browser when you run a query on your GraphiQL interface, it will run the query on the api endpoint.
In order to change the base path you would need to change application.properties into something like:
graphql.servlet.mapping: /service/api/query
graphiql.mapping: /graphiql
graphiql.endpoint: /service/api/query
If you are using Spring Boot Property file you can change the base url like below:
spring.graphql.path=/service/api/query
Example:
When I changed the base url like below.:
spring.graphql.path=/api/projects/graphql
It reflected like below in console:
2022-11-05 08:58:14.964 INFO 17336 --- [ main] s.b.a.g.s.GraphQlWebMvcAutoConfiguration : GraphQL endpoint HTTP POST /api/projects/graphql
More can be found at below official document:
https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#appendix.application-properties.web

Error executing “PutObject” on AWS

I am trying to read .png file from storage path of laravel and upload the same into amazon s3, but i'm getting this below issue:
{
"code": 422,
"status": "error",
"data": {
"exception": "Error executing \"PutObject\" on \"https://s3.amazonaws.com/mrxmms/123/12345_ach.png\"; AWS HTTP error:
count(): Parameter must be an array or an object that implements
Countable"
},
"message": "Unprocessable Entity" }
Here is my sample code:
$dir = storage_path('uploads'); $image_val = $dir. '/'
."product.png";
$image_load =
Storage::disk('s3')->put("123/12345.png",file_get_contents($image_val));
Can someone please help me? Thanks in advance!!
This issue hit me recently when using Guzzle in version 6.2.1 and AWS SDK in version 3.*
Updating Guzzle to 6.3.* solved the issue for me.
composer require guzzlehttp/guzzle:6.3.*
Hope that helps.

Kony service giving 1012 opstatus Request failed error and not giving response

I have a kony sample app where I am trying to do a build and the app has one web service in it for fetching categories of some product. I have the following code also that I wrote:
function GetCategories() {
var inputparam = {
"appID": "bbuy",
"serviceID": "GetCategories",
"catId": "cat00000",
"channel": "rc",
"httpheaders": {}
};
kony.net.invokeServiceAsync("http://192.168.42.134/middleware/MWservlet",inputparam, serv_GetCategoriesCallback);
}
I am getting no response for this. Getting 1012 opstatus and the message is saying "Request failed" error.
kony.net.invokeServiceAsync("http://192.168.42.134/middleware/MWservlet",inputparam, serv_GetCategoriesCallback);
In the above line, you have not given the port number in the MWservlet URL.(e.g. 8080) Give that and check.
Also, make sure all input params are being fed to the service and that they correspond to the exact naming convention followed in the service editor.
Visit :
Find the below link. i hope it gives you a solution
http://developer.kony.com/twiki/pub/Portal/Docs/API_Reference/Content/Network_APIs.htm#net.invo2
Check the mandatory and optional fields of Inputparam

Resources