I am sending an event to Facebook Conversion API. It sends fine when using the 'test_event_code' => 'TEST11781'. I receive it al ok in event manager. However, when I remove that test_event_code attribute, ie to make the event live, I am not receiving the events in event manager. Here is the json event code being sent. Any ideas why it sends to the test event but not the live event? Thanks.
{
"data": [
{
"event_name": "ViewContent",
"event_source_url": "https://www.domain.co.uk/",
"event_time": 1638201564,
"action_source": "website",
"user_data": {
"client_ip_address": "78.xxx.xx.79",
"client_user_agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
"em": "bee8327d3be983b71f5c3665225dd24b305362943e81738ec639e2b418c64d68",
"ph": "3e3d1c86840255608723f4a7e667f7482de0a877376347232336da4dec0fc6a1",
"ge": "62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a",
"ln": "a9cca5a75f06071ab13f05f8b017500014117c4022414cdfb7439ca332ccecbd",
"fn": "dbadfc88144b0c153a2d1bdf154681c857a237eb79d58df24e918bca6e17db05",
"ct": "b11c0468e61792336d6c0fca278f850aee8ab9e9d7d0df03e070df82b02188c8",
"st": "1de408006eb5a879c99e8ccda85bf7bcc72f1a22c9693fa7ef9fafec80e21b82",
"zp": "102ee65281e730945c8de2678fdb0659ddcf732c2a638c7f80f5322168726dad",
"country": "b4043b0b8297e379bc559ab33b6ae9c7a9b4ef6519d3baee53270f0c0dd3d960"
},
"custom_data": { "currency": "GBP", "value": "30", "content_ids": ["3268"], "num_items": "1", "content_type": "product", "content_name": "BASEBALL CAP" }
}
]
}
Related
I'm trying to build an Oauth2 flow. Cors keeps blocking my GET request to my own server.
localhost:3000 is the browser.
localhost:3001 is the server.
I have cors setup in NestJS below and it works for every other non-redirecting endpoint:
// main.ts
import { corsConfig } from '#common/config/index';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.enableCors({
origin: [
/^https?:\/\/localhost:3000/,
],
methods: ['GET', 'POST'],
credentials: true,
});
await app.listen(process.env.PORT || 3001);
}
bootstrap();
When requesting to my server endpoint... these are the request.headers
{
"host": "localhost:3001",
"connection": "keep-alive",
"sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"100\"",
"accept": "application/json, text/plain, */*",
"sec-ch-ua-mobile": "?0",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) SomeStuff",
"sec-ch-ua-platform": "\"Windows\"",
"origin": "http://localhost:3000",
"sec-fetch-site": "same-site",
"sec-fetch-mode": "cors",
"sec-fetch-dest": "empty",
"referer": "http://localhost:3000/",
"accept-encoding": "gzip, deflate, br",
"accept-language": "en-US,en;q=0.9,fr;q=0.8,es;q=0.7,de;q=0.6",
"cookie": "Authentication=someStuff"
}
When responding from my server, these are the response.headers
{
"cross-origin-opener-policy": "same-origin",
"cross-origin-resource-policy": "same-origin",
"x-dns-prefetch-control": "off",
"expect-ct": "max-age=0",
"x-frame-options": "SAMEORIGIN",
"strict-transport-security": "max-age=15552000; includeSubDomains",
"x-download-options": "noopen",
"x-content-type-options": "nosniff",
"origin-agent-cluster": "?1",
"x-permitted-cross-domain-policies": "none",
"referrer-policy": "no-referrer",
"x-xss-protection": "0",
"access-control-allow-origin": "http://localhost:3000",
"vary": "Origin",
"access-control-allow-credentials": "true",
"x-ratelimit-limit": "30",
"x-ratelimit-remaining": "28",
"x-ratelimit-reset": "60"
}
And this is the Cors error in my browser console
Access to XMLHttpRequest at 'https://example.com/' (redirected from
'http://localhost:3001/test') from origin 'http://localhost:3000'
has been blocked by CORS policy: No 'Access-Control-Allow-Origin'
header is present on the requested resource.
What do I need to change to allow a GET request to be redirected in the browser? Or is this not possible and it requires simply visiting the site with window.location?
I know this is not the ideal solution, but for my personal projects in a local environment, I used the "Moesif Origin & CORS Changer" browser extension to combat this annoying issue.
Google Chrome: https://chrome.google.com/webstore/detail/moesif-origin-cors-change/digfbfaphojjndkpccljibejjbppifbc
Firefox: https://addons.mozilla.org/en-US/firefox/addon/moesif-origin-cors-changer1/
I am using MS Graph Sign-in REST API to retrieve the Guest user sign-ins my tenant. But I have retrieved certain sign-ins which are showing the internal users as Guest in User Type attribute.
Also absorbed HomeTenantId and ResourceTenantId also differs.
Certain times, while logging in to Azure AD Portal, directory of the previously logged-in tenant are logged in. In that cases TenantId may differ and userType attribute is shown as Guest. But for SharePoint I am not sure of the user Type guest
This is confusing a bit. Any idea on why Internal users are shown as Guest Users
Request : https://graph.microsoft.com/beta/auditLogs/signIns
Sample Response:
{ "id": "$$$$$$",
"createdDateTime": "2021-08-29T10:22:06Z",
"userDisplayName": "user",
"userPrincipalName": "user#cortana.onmicrosoft.com",
"userId": "$$$$$",
"appId": "08e18876-6177-487e-b8b5-cf950c1e598c",
"appDisplayName": "SharePoint Online Web Client Extensibility",
"ipAddress": "$$$$$$",
"ipAddressFromResourceProvider": null,
"clientAppUsed": "",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36",
"correlationId": "*********",
"conditionalAccessStatus": "notApplied",
"originalRequestId": "",
"isInteractive": true,
"tokenIssuerName": "",
"tokenIssuerType": "AzureAD",
"processingTimeInMilliseconds": 173,
"riskDetail": "none",
"riskLevelAggregated": "none",
"riskLevelDuringSignIn": "none",
"riskState": "none",
"riskEventTypes": [],
"riskEventTypes_v2": [],
"resourceDisplayName": "Office 365 SharePoint Online",
"resourceId": "$$$$$$$",
"resourceTenantId": "$$$$$$$$$",
"homeTenantId": "#########",
"authenticationMethodsUsed": [],
"authenticationRequirement": "singleFactorAuthentication",
"alternateSignInName": "", "signInIdentifier": "",
"signInIdentifierType": null,
"servicePrincipalName": null,
"signInEventTypes": ["interactiveUser"],
"servicePrincipalId": "",
"userType": "guest",
"flaggedForReview": false,
"isTenantRestricted": false,
"autonomousSystemNumber": 45609,
"crossTenantAccessType": "b2bCollaboration",
"servicePrincipalCredentialKeyId": null,
"servicePrincipalCredentialThumbprint": "",
"mfaDetail": null,
"status": {
"errorCode": 0,
"failureReason": "Other.",
"additionalDetails": null },
"deviceDetail": {
"deviceId": "",
"displayName": "",
"operatingSystem": "Windows 10",
"browser": "Chrome 92.0.4515",
"isCompliant": false,
"isManaged": false,
"trustType": ""
}, "location": {
"city": "Kallimandayam",
"state": "Tamil Nadu",
"countryOrRegion": "IN",
"geoCoordinates": {
"altitude": null,
"latitude": "",
"longitude": ""
}}, "appliedConditionalAccessPolicies": [],
"authenticationProcessingDetails": [{
"key": "Login Hint Present",
"value": "True" },
{
"key": "User certificate authentication level",
"value": "singleFactorAuthentication" } ],
"networkLocationDetails": [],
"authenticationDetails": [],
"authenticationRequirementPolicies": [],
"sessionLifetimePolicies": [],
"privateLinkDetails": {
"policyId": "",
"policyName": "",
"resourceId": "",
"policyTenantId": "" } }
This is By Design. It is an expected behavior, considering that when a user is accessing a tenant where the user is a guest (inviting tenant), you will have this authentication logged in your side as well. When a user is invited to another directory as a guest, the user will authenticate with the credentials from his home tenant, as explained in the below link.
Reference - Authentication is performed by the guest user's identity provider - https://learn.microsoft.com/en-us/azure/active-directory/external-identities/user-properties
I'm using Azure B2C for authenticate my users. For authentication piece I have oauth2-proxy running in kubernetes cluster. Oauth2-Proxy is running behind ingress-nginx and it's passing most of required headers but I do not get X-Auth-Request-Groups header in my upstream service that is behind oauth2-proxy.
Here is my token that I get from B2C:
{
"typ": "JWT",
"alg": "RS256",
"kid": "kid_value"
}.{
"exp": 1604420825,
"nbf": 1604417225,
"ver": "1.0",
"iss": "iss_value",
"sub": "sub_value",
"aud": "aud_value",
"acr": "acr_name",
"nonce": "defaultNonce",
"iat": 1604417225,
"auth_time": 1604417225,
"groups": [
"group1"
],
"identityProviders": [
"email.com"
],
"firstname": "First Name",
"surname": "Last Name",
"idp": "IDP_VALUE",
"email": "username#email.com",
"preferred_username": "User Name"
}.[Signature]
And here are headers that I get in my upstream service after successful authentication:
{
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
Accept-Encoding: "gzip, deflate, br",
Accept-Language: "en-US,en;q=0.9",
Content-Length: "0",
Cookie: "COOKIE",
Sec-Fetch-Dest: "document",
Sec-Fetch-Mode: "navigate",
Sec-Fetch-Site: "none",
Sec-Fetch-User: "?1",
Upgrade-Insecure-Requests: "1",
User-Agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36",
X-Auth-Request-Access-Token: "ACCESS_TOKEN",
X-Auth-Request-Email: "username#email.com",
X-Auth-Request-Preferred-Username: "User Name",
X-Auth-Request-User: "UserID",
X-B3-Parentspanid: "Parentspanid",
X-B3-Sampled: "0",
X-B3-Spanid: "Spanid",
X-B3-Traceid: "Traceid",
X-Envoy-Attempt-Count: "1",
X-Forwarded-Client-Cert: "CEERT",
X-Forwarded-For: "Forwarded-For",
X-Forwarded-Host: "Forwarded-Host",
X-Forwarded-Port: "443",
X-Forwarded-Proto: "https",
X-Real-Ip: "Real-Ip",
X-Request-Id: "Request-Id",
X-Scheme: "https"
}
all X-Auth-Request-* headers are coming but not the one with Groups. I'm using docker image quay.io/oauth2-proxy/oauth2-proxy:v6.1.1 and I saw in config https://oauth2-proxy.github.io/oauth2-proxy/configuration option "--oidc-groups-claim" but when I try to use it container won't start because this option isn't available in this version.
Any ideas what I'm missing?
It seems that the problem is image that I'm using quay.io/oauth2-proxy/oauth2-proxy:v6.1.1, when I built own image from latest master (3rd of November 2020) everything seems to be working fine and X-Auth-Request-Groups header is passed to upstream service.
Where can I find a full list of the Tritium variables (such as $host, $path, $content_type, etc.)?
You can find all the accessible environment variables by looking at your tmp/messages/.../final-env.json file.
According to the doc:
All the environment variables available are listed in the
final-env.json file. This file can be found in the {Moovweb Project
Path}/tmp/messages/{Folder ID} directory. To use one of these
environment variables in Tritium, you need to add a dollar sign before
it: $variable.
They provide a sample final-env.json file there:
{
"0": "https://www.dropbox.com",
"1": "https://www.dropbox.com",
"2": "SAMEORIGIN",
"3": "HTTP/1.0",
"Content-Type-Charset": "UTF-8",
"__catch_all__": ".moovapp.com",
"accept_encoding": "gzip,deflate",
"asset_host": "http://localhost:3003/",
"body": "true",
"body_length": "1195",
"cache_control": "no-cache",
"canonical_found": "false",
"charset_determined": "UTF-8",
"connection": "close",
"content_type": "text/html; charset=utf-8",
"cookie": "gvc=Mjg1NjE0NTk0MjAxMDUyNjY4MTc1NjYyMDE3OTAxNjU0NDk4NTc2",
"date": "Fri, 07 Sep 2012 01:57:35 GMT",
"device_stylesheet": "main",
"found_conn": "true",
"header_hh": "Host: ",
"host": "mlocal.dropbox.com",
"host_hh": "https://mlocal.dropbox.com",
"key": "x_frame_options",
"location": "https://www.dropbox.com/",
"method": "GET",
"path": "/",
"pragma": "no-cache",
"rewriter_url": "false",
"secure": "false",
"server": "nginx/1.0.14",
"set_cookie": "flash=; Domain=dropbox.com; expires=Fri, 07-Sep-2012 01:57:35 GMT; Path=/; httponly",
"slash_path": "/",
"source_host": "www.dropbox.com",
"status": "302",
"use_global_replace_vars": "true",
"user_agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.54.16 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1",
"value": "SAMEORIGIN",
"x_frame_options": "SAMEORIGIN"
}
I have a dataset from video streaming logs. Each video is identified by a FileGUID. The log entries record the FileGUID, the fragment of the video watched and the bandwidth it was watched at.
I would like to create a mapreduce outputting, for each video, a count for fragments both total and for each bandwidth. Ideally it would look like;
{"FileGUID":"50acb3a5796634df0e073285",
{
"1":{"total":76, "0832":34, "1028":42},
"2":{"total":42, "0832":28, "1028":14},
...
}
}
Is this possible with one mapreduce or is it a multi-step process, or should I use a different method?
Here is a sample of the data.
{
"_id": ObjectId("50acb3a5796634df0e073285"),
"IP": "46.7.1.88",
"DateTime": ISODate("2012-10-24T22:59:57.0Z"),
"FileGUID": "8cdde821fb934a6da7c125a012a26612",
"Bandwidth": NumberInt(1028),
"Segment": NumberInt(1),
"Fragment": NumberInt(237),
"Status": NumberInt(200),
"Size": NumberInt(576790),
"UserAgent": "Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko\/20100101 Firefox\/16.0"
}
{
"_id": ObjectId("50acb3a5796634df0e073284"),
"IP": "46.7.1.88",
"DateTime": ISODate("2012-10-24T22:59:52.0Z"),
"FileGUID": "8cdde821fb934a6da7c125a012a26612",
"Bandwidth": NumberInt(1028),
"Segment": NumberInt(1),
"Fragment": NumberInt(236),
"Status": NumberInt(200),
"Size": NumberInt(577100),
"UserAgent": "Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko\/20100101 Firefox\/16.0"
}
{
"_id": ObjectId("50acb3a5796634df0e073283"),
"IP": "46.7.1.88",
"DateTime": ISODate("2012-10-24T22:59:47.0Z"),
"FileGUID": "8cdde821fb934a6da7c125a012a26612",
"Bandwidth": NumberInt(0832),
"Segment": NumberInt(1),
"Fragment": NumberInt(234),
"Status": NumberInt(200),
"Size": NumberInt(576664),
"UserAgent": "Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko\/20100101 Firefox\/16.0"
}
{
"_id": ObjectId("50acb3a5796634df0e073282"),
"IP": "46.7.1.88",
"DateTime": ISODate("2012-10-24T22:59:42.0Z"),
"FileGUID": "8cdde821fb934a6da7c125a012a26612",
"Bandwidth": NumberInt(0832),
"Segment": NumberInt(1),
"Fragment": NumberInt(233),
"Status": NumberInt(200),
"Size": NumberInt(575692),
"UserAgent": "Mozilla\/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko\/20100101 Firefox\/16.0"
}
You can do this with a single MapReduce job.
The map function emits the video IDs as a key and as value an object which consists of a single field. The field name is the bandwidth, the value is the running time of the current entry.
The reduce function sums up the objects fed to it. It iterates the values array, does a foreach loop over each array entry, and adds the value of each field to a field of the same name in the returned value.
The finalize function does a foreach loop over the resulting object and calculates the sum of all entries in it. It then puts the sum into the object as the field "total" (never do changes to an object you are currently looping over).