I'm using Laravel 5.5 with passports for API services. Its working fine after adding the "client credentials" route middleware in local.
'client_credentials' => \Laravel\Passport\Http\Middleware\CheckClientCredentials::class
**Local Setup: **
URL: http://localhost/server/public/index.php/api/v1/user/1
I got response as,
{
"status": 200,
"response_time": 0.050323009490967,
"body": {
"user": "admin",
"email": "admin#domain.com"
},
"message": "User found"
}
**AWS Setup: **
But, when I move to AWS server it won't authenticate.
URI: http://api_server.com/server/public/index.php/api/v1/user/1
I got error as,
{
"message": "Unauthenticated."
}
Both installations are same, and I can get access-token and reset-token by its endpoints.
But POST/GET/PUT/DELETE API calls are now allowed on AWS server.
Why it's not supporting on AWS?
Any other ways to solve this?
[Note: "web" group's "POST/GET/PUT/DELETE" routes are working fine.]
you can check for security groups .. where many traffic groups ports are by default blocked.
Related
I'm creating a website builder that will initially host users sites at wildcard subdomains. I want them to be able to add their custom domain by editing records on their domain registrar (i.e. A Record pointing to my IP - similar to how Firebase hosting, Squarespace, etc). I have personal name servers, but I would prefer to NOT use name servers - that way clients can keep/manage their MX and other records on their registrar.
I'm using cPanel API 2 to add domains, but unless the external domain has my name servers set, cpanel gives this error:
{
"cpanelresult": {
"preevent": {
"reason": "Oops, looks like example.com pointed to remote nameservers.",
"result": 0
},
"module": "AddonDomain",
"func": "addaddondomain",
"data": {
"result": 0,
"reason": "Oops, looks like example.com pointed to remote nameservers."
},
"error": "Oops, looks like example.com pointed to remote nameservers.",
"apiversion": 2
}
}
In the cPanel UI this error is followed by domain validation options - but not in the API response above.
Is there a way to bypass domain validation via the cpanel API? OR is there a better alternative to do what I'm wanting?
I am developing a project in Symforny 5 and I want to use Google Cloud Storage, install thephpleague / flysystem-bundle with superbalist / flysystem-google-storage support, as indicated in the documentation, generate the credentials.json in Google Console and the bucket, but I get the following error:
{
"error": {
"code": 401,
"message": "Invalid Credentials",
"errors": [
{
"message": "Invalid Credentials",
"domain": "global",
"reason": "authError",
"locationType": "header",
"location": "Authorization"
}
]
}
}
\vendor\google\cloud-core\src\RequestWrapper.php (line 362)
Configurations:
flysystem:
storages:
default.storage:
adapter: 'local'
options:
directory: '%kernel.project_dir%/var/storage/default'
gcs.storage:
adapter: 'gcloud'
options:
client: 'gcloud_client_service' # The service ID of the Google\Cloud\Storage\StorageClient instance
bucket: 'test-storage'
#prefix: 'optional/path/prefix'
api_url: 'https://storage.googleapis.com'
In service.yml
gcloud_client_service:
class: Google\Cloud\Storage\StorageClient
arguments:
- projectId: 'storage-project'
- keyFilePath: '../credentials.json'
The error you are getting because the credentials are not set correctly. If you want to use the JSON file, a way to solve this issue is setup the credentials inside your code using something like this:
putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json');
On the other hand, At this this other documentation you can find another way on how to set the configuration of the connection to GCS. Also remember to add the Service Account that you ant to use, going to IAM and adding the "Storage Bucket Admin" role to that SA.
Both of these options should work for you.
A bit late, but maybe it helps someone else. Today I had the same issue on Symfony 5.1, solved it by setting services.yaml this way:
services:
gcloud_client_service:
class: Google\Cloud\Storage\StorageClient
arguments:
$config:
keyFilePath: '%kernel.project_dir%/config/my_testing_config.json'
projectId: 'my-testing-project'
I have generated a consumer key and consumer secret. The website has SSL installed. I have also installed plugins required for JSON and REST services. This is how the url looks like:
https://<url>/wp-json/wc/v1/products
If you want to test
Consumer Key: ck_8add1dc9101f8793a731d6b9aeaadd319fbedf37
Consumer secret: cs_18980264faa482536874e4544dfce9c090c7e927
When I am trying to get(GET) the product details using Basic Auth by using POSTMAN, a Chrome plugin, I get a JSON response like:
{
"code": "woocommerce_rest_cannot_view",
"message": "Sorry, you cannot list resources.",
"data": {
"status": 401
}
}
I have both the READ and WRITE permissions corresponding to the Consumer key.
I'm testing this RestApi on PostMan RestClient and i disabled SSL certificate verification on this app settings
The API credentials do not have permissions to read data from woocommerce. Please update the permissions from the woo API settings page and make sure the credentials have Read/Write access or at least Read access.
I am currently struggling to get access to the google api when impersonating a user.
I can connect as that user however I am getting an error where I am presented with an error:
"error": {
"errors": [
{
"domain": "global",
"reason": "appNotAuthorizedToFile",
"message": "The user has not granted the app <app id> write access to the file <file id>",
"locationType": "header",
"location": "Authorization"
}
],
}
The recommended resolution is to use google Picker and get the user to allow my app to access this file. However as I am using a service account with domain wide delegation and g-suite enabled I thought this wasn't necessary.
my current php code is:
$client = new Google_Client();
$client->setApplicationName($appName);
$client->setAuthConfig($credentials);
$client->addScope($scopes);
$client->setClientId($key);
$client->useApplicationDefaultCredentials();
$client->setSubject($userTobe);
$client->setAccessType('offline');
I am using putenv to push my service_account.json into my file. I followed the quick start as it suggested. I have enabled all the required scopes in the security console. If I specify getRefreshTokenwithAssertion() i can get an access_token starting with ya29. however this still presents the error above.
I am currently at a loss on where to go from here. Any help would be greatly appreciated.
Which scopes are you using? Please ensure you are setting the drive auth scope in your application: https://www.googleapis.com/auth/drive (Google_service_Drive::DRIVE)
Has the client and scopes been authorized in the admin console?
admin console => security => Advanced settings => manage API client access
We are migrating data from one server to server. The requests that come to older server is being redirected to the new Ip address using htaccess. The older domain is registered with facebook. In the new domain I am getting the facebook authentication error.
"error": {
"message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
"type": "OAuthException",
"code": 191 }
is there any way to do using htaccess so that it will take the older registered domain name while accessing facebook api's?