PHP Laravel signature Client error: POST https://api.opentok.com/session/create resulted in a 403 Forbidden - opentok

I am using "opentok/opentok": "^4.7" in PHP laravel project.
use OpenTok\OpenTok;
$apiKey = env('OPENTOK_API_KEY');
$apiSecret = env('OPENTOK_API_SECRET');
$apiObj = new OpenTok($apiKey, $apiSecret);
$session = $apiObj->createSession();
But it is giving me below error : "Invalid signature" , see screenshots attached.
I also tried https://tokbox.com/tools/credential-validator/ to validate signature , and the signatures are validated on this link.
I also tried https://tokbox.com/developer/tools/playground/ to check if session work, its working.
I checked this https://support.tokbox.com/hc/en-us/articles/360054612532-Unable-to-create-session-even-though-API-key-and-secret-are-valid also,
and update time by hit command : "sudo ntpdate time.nist.gov"
I also tried https://github.com/opentok/Opentok-PHP-SDK#creating-sessions the hello world SDK, but giving same error.
enter image description here

Related

How to load a AzureML model in an Azure Databricks compute?

I am trying to run a DatabricksStep. I have used ServicePrincipalAuthentication to authenticate the run:
appId = dbutils.secrets.get(<secret-scope-name>, <client-id>)
tenant = dbutils.secrets.get(<secret-scope-name>, <directory-id>)
clientSecret = dbutils.secrets.get(<secret-scope-name>, <client-secret>)
subscription_id = dbutils.secrets.get(<secret-scope-name>, <subscription-id>)
resource_group = <aml-rgp-name>
workspace_name = <aml-ws-name>
svc_pr = ServicePrincipalAuthentication(
tenant_id=tenant,
service_principal_id=appId,
service_principal_password=clientSecret)
ws = Workspace(
subscription_id=subscription_id,
resource_group=resource_group,
workspace_name=workspace_name,
auth=svc_pr
)
The authentication is successful since running the following block of code gives the desired output:
subscription_id = ws.subscription_id
resource_group = ws.resource_group
workspace_name = ws.name
workspace_region = ws.location
print(subscription_id, resource_group, workspace_name, workspace_region, sep='\n')
However, the following block of codes gives an error:
model_name=<registered-model-name>
model_path = Model.get_model_path(model_name=model_name, _workspace=ws)
loaded_model = joblib.load(model_path)
print('model loaded!')
This is giving an error:
UserErrorException:
Message:
Operation returned an invalid status code 'Forbidden'. The possible reason could be:
1. You are not authorized to access this resource, or directory listing denied.
2. you may not login your azure service, or use other subscription, you can check your
default account by running azure cli commend:
'az account list -o table'.
3. You have multiple objects/login session opened, please close all session and try again.
InnerException None
ErrorResponse
{
"error": {
"message": "\nOperation returned an invalid status code 'Forbidden'. The possible reason could be:\n1. You are not authorized to access this resource, or directory listing denied.\n2. you may not login your azure service, or use other subscription, you can check your\ndefault account by running azure cli commend:\n'az account list -o table'.\n3. You have multiple objects/login session opened, please close all session and try again.\n ",
"code": "UserError"
}
}
The error is Forbidden Error even though I have authenticated using ServicePrincipalAuthentication.
How to resolve this error to run inference using an AML registered model in ADB?
The Databricks workspace need to be present in the same subscription as your AML workspace.
This notebook demonstrates the use of DatabricksStep in Azure Machine Learning Pipeline.
Here is the Model class register.

Databrick - Reading BLOB from Mounted filestorage

I am using Azure databricks and I ran the following Python code:
sas_token = "<my sas key>"
dbutils.fs.mount(
source = "wasbs://<container>#<storageaccount>.blob.core.windows.net",
mount_point = "/mnt/gl",
extra_configs = {"fs.azure.sas.<container>.<storageaccount>.blob.core.windows.net": sas_token})
This seemed to run fine. So I then ran:
df = spark.read.text("/mnt/gl/glAgg_LE.csv")
Which gave me the error:
shaded.databricks.org.apache.hadoop.fs.azure.AzureException: com.microsoft.azure.storage.StorageException: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
Not sure what I'm doing wrong though. I'm pretty sure my sas key is correct.
Ok if you are getting this error - double check both the SAS key and the container name.
Turned out I had pointed it to the wrong container!

Authorize.net Webhooks - need detailed error message

We are trying to get up to speed using Authorize.net Webhooks to connect to our Salesforce external site. Our Salesforce endpoint seems to be working OK, because I can call it using curl from the command line and pass a JSON structure that gets successfully saved to our database. This much works fine.
However when I enter the URL of our Webhook into the "Endpoint URL:" field in Authorize.net and click the "Test Webhook" button, I get the error message:
"Error: Error occured in connecting to the endpoint: (prints my endpoint URL)
I am sure that I am calling the correct URL because I have copied and pasted it from the command line into the Endpoint URL field. But I need to know why I'm getting this error. Is there a debug log for Webhooks? Or how can I get a more detailed error message from Authorize.net?
Just be clear - this is testing a webhook call from Authorize.net -> Salesforce.
Edit: the CURL call that works from the command line is:
curl -X POST -H "Content-Type: application/json" -d '{"test":"this"}' \
https://my.server.com/mysite/services/apexrest/PYMT_AuthnetHook
Thanks and Best Regards!

PhantomJS failing on remote ajax field check

I developed a script to complete & submit a remote form via PhantomJS (version 2.1). For testing I built a local approximation of the remote form which included an ajax field check upon input (so, you enter an email address in the email field, and after a second it checks to see if it's a valid input). My phantom script fills out the fields, waits a few seconds for an error to be thrown, and then carries on to submit the form if everything looks okay. This all worked just fine with everything running on localhost.
However, as soon as I switch to making the call to the remote webpage (which is a third-party site; I have no access to make changes to it), it fails when the remote page performs the ajax check on fields. I have the following onResourceError function:
page.onResourceError = function(resourceError) {
system.stderr.writeLine('= onResourceError()');
system.stderr.writeLine(' - unable to load url: "' + resourceError.url + '"');
system.stderr.writeLine(' - error code: ' + resourceError.errorCode + ', description: ' + resourceError.errorString );
};
...and if I run the following line (in a Windows command prompt):
phantomjs.exe form-process.js "https://contact.site.com/auth/form?params=that&are=always&the=same" "clarence#email.com"
I get the following error:
https://contact.site.com/ajax/email-check?email=clarence#email.com"
- error code: 302,
- description: Error downloading "https://contact.site.com/ajax/email-check?email=clarence#email.com"
- server replied: Bad request
I am running this from a local environment but with no SSL certificate installed, so I assumed (based on the description of the 302 error code: the requested operation is invalid for this protocol) that it was a cross-protocol issue. But running the phantomJS line with any combination of --ssl-protocol=any, --ignore-ssl-errors=yes or --web-security=false yields the same results.
I may be misunderstanding these modes for phantomJS, but I assumed that --ssl-protocol=any would dismiss this issue, but would I still need to have a local SSL cert to get this to work? Or is there another issue here?

CodeIgniter "No input file specified"

I just finished developing a website using codeigniter and in the end the person I was developing for switched from one hosting service to another. Now, when I try to go in the website at first I got a message saying
"No input file specified"
after going through some websites I found out I could try and fix this by using index.php? changing these on the config.php file:
$config['index_page'] = "index.php?";
$config['uri_protocol'] = "QUERY_STRING";
I tried that but now I am getting this message:
A PHP Error was encountered
Severity: Notice
Message: Undefined property:
Login::$session
Filename: controllers/login.php
Line Number: 121
Fatal error: Call to a member function
userdata() on a non-object in
/home/content/34/5024634/html/pdv/application/controllers/login.php
on line 121
on line 121 of controllers/login.php you see this:
if ($this->session->userdata('logged_in') == TRUE)
which works perfectly fine on the old server as well as on localhost. Now, going back to the previous host isn't an option according to my client so I've been stuck with this error for a while now and haven't been able to find any solution, would any of you guys know how to fix this?
The most helpful websites I've checked out are these two:
http://anon83.wordpress.com/2007/12/11/codeigniter-vs-godaddy-problems/
http://codeigniter.com/wiki/Godaddy_Installaton_Tips/
You probably forgot to load your session library
$this->load->library('session'); in your construct or autoload it.

Resources