Apple app site association - bad JSON content - ios

The Apple-app-site association is failing. Haven't found a solution yet. I checked for valid JSON in the JSON validator which says -valid JSON
But it doesn't redirect to the app. I have hosted
The apple-app-site association file (without the extension as mentioned in the Apple documentation) has no restrictions on the web server and that URL. I have validated the link on this web page [https://branch.io/resources/aasa-validator]
But it didn't redirect the app.
I found this method to validate AASA files
curl -v https://app-site-association.cdn-apple.com/a/v1/yourdomain.com
The response is like this
Mark bundle as not supporting multiuse
HTTP/1.1 404 Not Found
Date: Wed, 04 Jan 2023 17:52:29 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 10
Connection: keep-alive
Apple-Failure-Details: {"cause":"invalid character '/' looking for beginning of value"}
Apple-Failure-Reason: SWCERR00401 Bad JSON content
Please someone help me to understand what is wrong with this JSON
{
"applinks": {
"details": [
{
"appIDs": [
"teamID.com.app.menu" //example
],
"components": [
{
"/": "/*",
"comment": "Matches any URL whose path starts with /"
},
{
"/": "/contact-us/*",
"exclude": true,
"comment": "Matches any URL whose path starts with /contact-us/ and instructs the system not to open it as a universal link"
}
]
}
]
},
"appclips": {
"apps": [
]
}
}
Links redirected when I added this mode on the simulator

Remove //example from your JSON.

Related

Apple App Site Association File Parsing Error

We're trying to get universal links working in our app but we are encountering errors when trying to download the Apple App Site Association file.
We've used various online tools to validate the file and they all say their is a parsing error but they don't go into any detail about what the issue is.
We've validated that the JSON is valid but what else could be wrong with the file contents?
{
"applinks": {
"details": [
{
"appIDs": [ "12345NGB.co.uk.my.app" ],
"components": [
{
"/": "/universallink/*",
"comment": "Matches any URL whose path starts with /universallink/"
}
]
}
]
}
}
It turns the I did need to follow the format outlined here: https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html
{
"applinks": {
"apps": [],
"details": [{
"appID": "12345NGB.co.uk.my.app",
"paths": ["/universallink/*"]
}]
}
}
The Apple documentation is very misleading because it suggests that's an old format for supporting iOS 12 and earlier.

Where can i find the digest for my docker image so I can delete it from the Registry?

Update
After reading the documentation a few more times, I realized I'b been looking in the wrong place for the digest. It is NOT in the manifest.
If you do a HEAD or GET on the v2/name/manifests/tag you will get a header (Docker-Content-Digest) which contains the digest:
Server nginx
Date Sat, 02 Nov 2019 19:01:16 GMT
Content-Type application/vnd.docker.distribution.manifest.v1+prettyjws
Content-Length 2839
Connection keep-alive
Docker-Content-Digest sha256:fcb864bea187b2efbf23d1032052461170fcb482e2dd99f9db5f9a8b538e553d
Docker-Distribution-Api-Version registry/2.0
Depending on the version of your Registry (or may be unrelated to that), the inclusion of a specific header at the time of sending GET or HEAD will cause a different digest to be returned.
This header is:
Accept: application/vnd.docker.distribution.manifest.v2+json
Even though the version of Registry that I'm dealing with is 2.0 inclusion of this header causes a different value to be returned for Docker-Content-Digest
Anyways, I tried both variations and I'm still not able to delete each time getting
{
"errors": [
{
"code": "DIGEST_INVALID",
"message": "provided digest did not match uploaded content"
}
]
}
Here's a link to the documenation in case someone's interested in it:
https://docs.docker.com/registry/spec/api/
Original
I have the following manifest which is downloaded for my image. I have tried every string here in place of the Digest but I have not been able to do that.
Could someone point out which one of these is the digest that i need for a Delete command?
I am using a DELETE http request with the following formulation:
https://my_registry.com/v2/demo/derivedimage/manifests/<whatever the digest is supposed to be here>
This is the error I get every time:
{
"errors": [
{
"code": "DIGEST_INVALID",
"message": "provided digest did not match uploaded content"
}
]
}
{
"schemaVersion": 1,
"name": "demo/derivedimage",
"tag": "4c3a6f78fe709a098a0d24a2c43639e7e170bc5981004554a154245662fea132",
"architecture": "amd64",
"fsLayers": [
{
"blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
},
{
"blobSum": "sha256:0f8c40e1270f10d085dda8ce12b7c5b17cd808f055df5a7222f54837ca0feae0"
}
],
"history": [
{
"v1Compatibility": "{\"architecture\":\"amd64\",\"config\":{\"Hostname\":\"\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":[\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"],\"Cmd\":[\"sh\"],\"ArgsEscaped\":true,\"Image\":\"sha256:02cc0eb9e9d093c512e57d613a9c1d89b0b50b551bbed33e3116459e7d15ee7e\",\"Volumes\":null,\"WorkingDir\":\"\",\"Entrypoint\":null,\"OnBuild\":null,\"Labels\":null},\"container\":\"e24c19c10096d9b60b9ac2276cc24ec9a1ab93e8330dff511362b8e983a4e040\",\"container_config\":{\"Hostname\":\"e24c19c10096\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":[\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"],\"Cmd\":[\"/bin/sh\",\"-c\",\"#(nop) \",\"CMD [\\\"sh\\\"]\"],\"ArgsEscaped\":true,\"Image\":\"sha256:02cc0eb9e9d093c512e57d613a9c1d89b0b50b551bbed33e3116459e7d15ee7e\",\"Volumes\":null,\"WorkingDir\":\"\",\"Entrypoint\":null,\"OnBuild\":null,\"Labels\":{}},\"created\":\"2019-10-30T23:20:37.206592274Z\",\"docker_version\":\"18.06.1-ce\",\"id\":\"d624e6ec746cd764114cfd7f4ab1fb0852e670c10df15adb1e75b4f99e4123be\",\"os\":\"linux\",\"parent\":\"9f31ac69fd90b9035252a2e1bac45e3d43b7d32316be7e4ac7a737d9d11b092b\",\"throwaway\":true}"
},
{
"v1Compatibility": "{\"id\":\"9f31ac69fd90b9035252a2e1bac45e3d43b7d32316be7e4ac7a737d9d11b092b\",\"created\":\"2019-10-30T23:20:37.083008444Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c #(nop) ADD file:1141b81e5149cc37c4346ee17e282cca8c7016a9bcfeb7a54842a87ecf8419d4 in / \"]}}"
}
],
"signatures": [
{
"header": {
"jwk": {
"crv": "P-256",
"kid": "3NQM:K5YD:M3XF:EKJD:4S64:3772:BJOT:JIMR:NX4R:2XYS:IDNA:NOKL",
"kty": "EC",
"x": "k6pZfyr-dKYLri5KJCL70UmNLCQnfUh2lAC_nDK9PVw",
"y": "MhrKOUbx1sgsbF0kG9d5bfvkVaxaFWiKlWTwgFyHkbQ"
},
"alg": "ES256"
},
"signature": "0TWLKZlltDA4kQJR4orhg7NenglG2OevQMSaN-RXCwFod7cyO5VFLVEeBDvsFhuAsvsw8mO475g1G9bW_Zh-aA",
"protected": "eyJmb3JtYXRMZW5ndGgiOjIxOTIsImZvcm1hdFRhaWwiOiJDbjAiLCJ0aW1lIjoiMjAxOS0xMS0wMVQwNDowMTowNloifQ"
}
]
}
The answer is how the digest is sent. In my case, I had to include the header:
Accept: application/vnd.docker.distribution.manifest.v2+json
to get the right digest in the incoming header Docker-Content-Digest
Second I had to include the "sha256:" in the outgoing digest. Example:
curl -vk -X DELETE https://my_registry.com/v2/demo/derivedimage/manifests/sha256:679b1c1058c1f2dc59a3ee70eed986a88811c0205c8ceea57cec5f22d2c3fbb1
And the reponse is:
HTTP/1.1 202 Accepted

Azure Logic App returns 404 with valid Project Online ODATA query using /_api/Projectdata

I want to filter and select Project Online data using Enterprise Custom Fields (ECF) in an Azure Logic App. I start with the out-of-the-box Project Online connector to trigger on project publish, then list project and task details.
Using the default connector, I can return project data but it does not contain the ECF data. Looking at the generated code, the Project Online connector uses /_api/ProjectServer. If I make similar requests (outside of Logic Apps) using /_api/Projectdata I get the ECF data.
If I edit the Logic App code with modified URL and fields, I get a 404 error. There seems to be something missing that I cannot see when I make the request with the modified values from within the Logic App.
My guess is the connector is limiting access to /_api/Projectdata (though the trigger itself is using this URL).
The following returns the data I want if I request it straight from the browser:
https://tenant.sharepoint.com/sites/PWA/_api/Projectdata/Projects(guid'project_GUID')
This is the raw input in the logic app:
{
"host": {
"connection": {
"name": "/subscriptions/subscription_GUID/resourceGroups/MyRG/providers/Microsoft.Web/connections/projectonline-1"
}
},
"method": "get",
"path": "/_api/Projectdata/Projects(guid'project_GUID')",
"queries": {
"siteUrl": "https://tenant.sharepoint.com/sites/PWA"
}
}
This is the raw output of the error:
{
"statusCode": 404,
"headers": {
"Access-Control-Allow-Methods": "GET, PUT, PATCH, DELETE, POST",
"Access-Control-Allow-Origin": "*",
"Access-Control-Max-Age": "3600",
"Access-Control-Expose-Headers": "*",
"Date": "Thu, 20 Sep 2018 16:58:42 GMT",
"Content-Length": "54",
"Content-Type": "application/json"
},
"body": {
"statusCode": 404,
"message": "Resource not found"
}
}
URLs and GUID have been modified in the examples above.

Universal link - The domain has some validation issue

Im working on universal link to open the application while tap the url. I am using https server and done all the steps from apple (Apple Doc). But the apple universal link validator show below error,
Your file's 'content-type' header was not found or was not recognized.
The apple-app-site-association file successfully uploaded to server and the file be like below,
{
"applinks": {
"apps": [],
"details": [
{
"appID": "J2HBF9A3PZ.com.aors.speaku",
"paths": ["*","/"]
}
]
}
}
And apple said no need to sign the apple-app-site-association file whether the domain has https.
If the file is unsigned, it should have a Content-Type of
application/json. Otherwise, it should be application/pkcs7-mime.
So my query is how to mention the content type (application/json) in this apple-app-site-association file???
please help me on this. i don't know what it mean exactly.
I just solved this issue myself. I had to logon to my server and go to the directory where the apple-app-site-association file was. In this directory, I had a .htaccess file which I modified to include the following lines:
<Files "apple-app-site-association">
ForceType 'application/json'
</Files>
After doing this, the validation service stopped complaining about the Content-Type.
NOTES:
If you don't have a .htaccess file, you can just create one.
I presume the .htaccess file should be in the root of your site directory (which is where you would most likely have placed your apple-app-site-association file.
Wordpress website. Pasting this at the end of .htaccess actually worked for me:
Header set Content-type "application/pkcs7-mime"
This one fixed the content type validation in firebase.json file.
{
"hosting": {
"public": "public",
"headers": [
{
"source": "/.well-known/apple-app-site-association",
"headers": [
{
"key": "Content-Type",
"value": "application/json"
}
]
}
],
"appAssociation": "NONE"
}
}
This syntax is what worked for me:
<FilesMatch "apple-app-site-association">
ForceType application/json
</FilesMatch>

Universal Linking Bad JSON

I have my apple-app-site-association uploaded correctly on the server. It's formatted as follows:
{
"activitycontinuation": {
"apps": [
"ASDF.com.company.appname"
]
},
"applinks": {
"apps": [],
"details": [
{
"appID": "ASDF.com.company.appname",
"paths": [ "/menu/*", "/menu/*/*", "/account/history", "/"]
}
]
}
}
My entitlements is set up correctly:
applinks:company-site.com
activitycontinuation:company-site.com
I've verified with Charles proxy on install the device fetches the correct file from the server.
When looking at the device log, I get the following error:
Bad apple-app-site-association JSON: Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
I've ran the JSON through a linter and it came out fine. The server sends back Content-Type: application/json in the header. I'm testing on a physical device. I've tried typing the URLs manually in safari and clicking them through a text message. Does anyone see where the problem is?
I believe the first section of your apple-app-site-association is unnecessary and may be causing the validation error (Apple is pretty strict about this file). I haven't seen this in any other places — is there a particular reason you're including it?
Try this and see if it works better:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "ASDF.com.company.appname",
"paths": [ "/menu/*", "/menu/*/*", "/account/history", "/"]
}
]
}
}
Also note that Universal Links will never work when entered manually into Safari. See here for more info.

Resources