Unable to verify event hook - authentication

I am testing out the event hook feature in Okta, but when I try to verify the endpoint, the message came out to be:
Unable to verify event hook. Could not deserialize response due to error at Line 1 Column 1
My functions will detect the X-Okta-Verification-Challenge header and outputs a response something like: : { “verification”: “ks58ZrThPLf22kTDavKLhm9aukKNECTmg–3gpsw” }
What am I doing wrong here?
The authentication field, secret and header fields are empty in the settings.
Thanks.

Related

Error when checking for custom claims property on rules auth token

I receive an error in the emulator when I try to check for a custom claim field that does not exist on the request.auth.token object when checking storage.rules. The request fails which is correct if the property is missing but I am concerned about the error.
function isPlatformVerified() {
return request.auth.token.platformVerified == 'ok';
}
and this is the error shown in the emulator:
com.google.firebase.rules.runtime.common.EvaluationException: Error: /Users/marcel/git/dev/storage.rules line [68], column [14]. Property platformVerified is undefined on object.
I wish to check if the custom claims has this property and if it has that it contains the correct value. How do I do this without getting an error (or can I ignore this??)
Many thanks
Most likely the custom claim hasn't propagated to the client and rules yet.
Custom claims are part of the token that the client sends with its requests, and that token is only auto-refreshed once per hour. So it may take up to an hour before a new claim shows up in the client, and thus in the security rules.
You can force a refresh of the ID token on the client by calling user.reload(), to ensure that the new claims will be present before the auto-refresh.

set error http status in response payload in mule 4

my requirement is to sent the error http status and error message in the body.
In Case of error in flow i need to pass the http code in the status field.
I can configure this http listner but don't know how to set this to get into payload. Please guide on that.
I'm expecting the MEL to get the 400 Bad Request
{
'status': "400 Bad Request",
'message': error.description
}
I could think of 2 ways of doing this:
1.You can use RAML and for every status code you can send appropriate responses as per your use case.This I think is the best way of doing it.
2.You can have the value for status and message key of your response body inside error handling block.Configure the 'TYPE' condition of your error handling block to catch a certain HTTP error message , then inside that you can set 2 vars: one with the status value and other with message value.Then use this vars in the Error response section of HTTP listener. You'll be ending up with many such error handling blocks if you want to address multiple status codes.
Let me know if you need further clarifications.Hope it helps.

How to check if all status codes are 200 in Mulesoft 4?

Say for example, I created a flow for scatter-gather and I want to check if all endpoints are returning same result status code 200 or throw an error if not.
Configure the Response Validator (General > Response > Response Validator) for each HTTP Request so only 200..299 responses are considered valid.
You can use try block for every HTTP request on wrap whole scatter gather. If one fails, capture HTTP status code in on error propogate and log the results.
I suggest you wrap each request into try block, if you already have a global error handler defined, it should pick up status code 500 etc. Otherwise, capture response code into dataweave

Laravel 5.7 Handle email verification errors from API

I'm using laravel 5.7 to build an API REST.
When I add the verified middleware to my route group and I try to login with an unverified user by my client api, I get the error 400 Bad request. This error is too generic and don't show the problem clearly for my customer (it's happens in a login form).
If I to edit the render() method in Handler.php to ignore the isApiCall() and return parent::render($request, $e);, so I get the full error (Your email address is not verified, status 403), but when I try to return this in a json object with response()->json([$e]), the response is always empty.
So how to handle properly the api errors to be return the full message from exception, in this case?
You probably have already solved this problem, but this solution might help someone else:
The reason why your response was returning an empty array is because you were passing an Exception type object into the json function that is expecting an array. The response should look like this:
return response()->json(['message' => $e->getMessage()]);
This will return a json response like:
{
"message": "Your email address is not verified"
}

Passbook update tag: if-modified-since (null)

I am using Restlet2.0 (java) to build passbook server. When I send a Push Notification to APNs with PushToken, I got message 'if-modified-since (null)' from the server log:
entity.getText() : {"logs":["[2013-03-31 00:18:29 +1100] Get pass task
(pass type pass.xxxxxx.freehug, serial number ABC, if-modified-since
(null); with web service url
http://192.168.1.43:8080/passbook/restlet) encountered error:
Server response was malformed (Missing response data)"]}
This responding URL matches the router defined for the LoggingResource class (Line 4), but not the SerialNumbersPassWithDeviceResource class (Line 2) which defines the passUpdatedSince={tag} parameter to be captured for the latest pkpass comparison:
router.attach("/v1/devices/{deviceLibraryIdentifier}/registrations/{passTypeIdentifier}/{serialNumber}", DeviceRegistrationResource.class); //1/4. Registration - POST/DELETE
router.attach("/v1/devices/{deviceLibraryIdentifier}/registrations/{passTypeIdentifier}?passUpdatedSince={tag}", SerialNumbersPassWithDeviceResource.class); //2. SerialNumbers - GET
router.attach("/v1/passes/{passTypeIdentifier}/{serialNumber}", LatestVersionPassResource.class); //3. LatestVersion - GET
router.attach("/v1/log", LoggingResource.class); //5. Logging - POST
So where can I set the Update Tag (passUpdatedSince={tag}) and how can I get it under the router in above Line 2? Is my router setup for getting Update tag correct?
The passUpdatedSince={tag} value is set from the last successful response that your web service gave to the requsest:
https://{webServiceURL}/v1/devices/{deviceLibraryIdentifier}/registrations/{passTypeIdentifier}
You set it by providing a key of lastUpdated in the JSON dictionary response to the above request. The value can be anything you like, but the simplest approach would be to use a timestamp.
The if-modified-since value is set by the Last-Modified HTTP header sent with the last .pkpass bundle received matching the passTypeIdentifier and serialNumber. Again, you can choose what value to send in this header.
The specific error that you mention above is not due to either of these. It is caused by your web service not providing a .pkpass bundle in response to the request to:
https://{webServiceURL}/v1/passes/{passTypeIdentifier}/{serialNumber}
You may want to try hooking your device up to Xcode, turning on PassKit logging (Settings -> Developer), then monitoring the device's console log as you send the push. This may give you more detail as to why the device sent the message to your web service log.