Attach users to endpoints - kaa

I have attached a user to an Endpoint using KaaClient.attachUser() methond(using trustful verifier), and I received a success status message back from server. But, where do I see this user in Admin UI? Moreover, If I try to use the the userID and try to push a configuration update to endpoint, I receive item not found error on Admin UI.

Currently there is no such feature that would allow to list all the attached users. Updating configuration values of configuration schema for a user (using userID) via Admin UI is possible only after that user has been attached in a client app at lease one time:
KaaClient.attachUser(userId, ...)
To use custom user configuration schema with different values for different attached users try to follow the instructions below:
Add a configuration schema for needed demo application (in this guide we will use Event Demo):
Login to Administration UI as a tenant developer
Go to Applications -> Event Demo -> Schemas -> Configuration. Click
Add Schema button
On the "Add configuration schema" page click Create new type button
Fill all required fields: Name (e.g. EventUserSchema), Namespace
(e.g. org.kaa.kaaproject.demo.schema), Display name (Event User
Schema) etc.
Add all needed fields to the schema (e.g. fields "userKey" and
"userValue" with "String" type and field "count" with "Integer" type
and default value "42"): on the same page for each field click Add
button in the "Fields" area, fill all required data included Field
name and Field type and click Add button.
After all fields are added on the top of the page click Add button.
If you do everything right new configuration schema with version "2"
and name "Event User Schema" will be listed on the page. If you
export it and open with a file reader you will see something like
this:
{
"type": "record",
"name": "EventUserSchema",
"namespace": "org.kaa.kaaproject.demo.schema",
"fields": [
{
"name": "userKey",
"type": [
{
"type": "string",
"avro.java.string": "String"
},
"null"
],
"displayName": "",
"displayPrompt": ""
},
{
"name": "userValue",
"type": [
{
"type": "string",
"avro.java.string": "String"
},
"null"
]
},
{
"name": "count",
"type": "int",
"by_default": 42
}
],
"version": 1,
"dependencies": [],
"displayName": "Event User Schema",
"description": ""
}
Add SDK profile with newly created configuration schema:
Go to Applications -> Event Demo -> SDK profiles. Click Add SDK
profile button.
Enter Name (e.g. EventUserSDK), select Configuration schema version
(for this case the version should be set to 2), add needed Event
class families (for Event Demo we need Chan Event Class Family),
select Trustful verifier.
On the same page click Add SDK profile button.
If everything is ok SDK profile with name "EventUserSDK" and
Configuration "v2" will be listed on SDK profiles page.
On the same page click Generate SDK button for newly created SDK,
select needed language and click Generate SDK button to download new
SDK.
Replace SDK library from your client application with new downloaded SDK, rebuild your app. After that you will be able to use configuration values, related to the defined configuration schema, in the application:
kaaClient.getConfiguration().getCount();
kaaClient.getConfiguration().getUserKey();
kaaClient.getConfiguration().getUserValue();
These values can be used after KaaClient.attachUser(...) place in code.
After running the app. If the user is attached successfully and you receive something like Attach response: SUCCESS, the configuration values will be set to default ones (default values are described in the configuration schema) and you will able to change them for each userID on the appropriate admin page:
Go to Applications > Event Demo -> Users > Update configuration.
Enter userID that has been already attached to KaaClient.
Select configuration schema version and fill all values for
configuration body area.
Click Update configuration button.
The configuration values will be changed for all endpoints which use the entered userID.
It is also possible to setup configuration schemes and values via REST. Please see Server REST APIs documentation page .

Related

Firebase Log-in events

I want to see Who and When login to the Firebase from UI side, as administrator.
It is not related data access from app etc.
So, I login to https://firebase.google.com/ as User/Manager/Admin and want to see it in logs.
It should be in GCP project related to firebase, if so how can I find it - did saw in Log explorer.
Or it should be in Firebase UI?
thank you in advance.
I would give you a workaround. You can use Firebase Management API which is in beta.
Consider you have to watch a project.
You can make a request like below to get the Project Details.
GET https://firebase.googleapis.com/v1beta1/projects/{YourProjectID}
Sample Response:
{
"projectId": "*****************",
"projectNumber": "*****************",
"displayName": "Sample App",
"name": "projects/*****************",
"resources": {
"hostingSite": "*****************",
"realtimeDatabaseInstance": "*****************"
},
"state": "ACTIVE",
"etag": "1_d15ff4d3-727e-431c-8eba-f33957805f23"
}
In the response, you have a key called ETAG. Basically, this changes whenever the project is opened by someone.
You cannot get who is logged-in or other details.
You can only know someone has opened, changed or made some operations in the project, using ETAG.
You can simply store the ETAG in your server and poll for the change.
If it is changed, then someone might have used the Project.
If you want the Updated Time of the project along with it, you can try this,
https://cloud.google.com/resource-manager/reference/rest/v3/projects/get

Mesibo Dashboard becomes inaccessible after API call fail

I am trying to create a new user through the backend.
My backend is a spring-boot application Java-based.
The API call end with a JSON object and have the result key set to false, with no other information to understand why the user has not been created. And then, when I tried to refresh the Mesibo dashboard, I got an empty page, with errors in the browser console.
This the user I try to save in Mesibo.
{
"op": "useradd",
"token": "I put here my app token",
"user": {
"address": "newuser#email.com",
"name": "User Name",
"token": {
"appid": "com.fake.id"
}
}
}
The image shows what I see in the browser console when I try to access It.
mesibo browser console
It is important to note, that the account I use is not mine, I use the one my company gave me.
We are trying to implement our flow, so we are not in prod we are just testing APIs and others...
Thank you very much for your help!
Anas
PS: I created my own account on mesibo and got the same result!

Universal link common to both Full App and AppClip

I want to use universal link common to both Full App and AppClip ex: https://example.com, and the desired scenario is as follows:
  1. When users install AppClip, scan this link will show AppClip Card
  2. When users install Full App, scan this link will show Full App
This is the content in the file https://example.com/.well-known/apple-app-site-association I have installed:
`{
"applinks": {
"apps": [],
"details": [{
"appID": "teamId.xxx.yyy.Example",
"paths": ["*"]
}]
},
"appclips": {
"apps": ["teamId.xxx.yyy.Example.Clip"]
}
}
`
Here is the Associated Domains setting on the Xcode side:
Full App: applinks:example.com
AppClip: appclips:example.com
But the results are not as expected, when scanning the link, it always shows the AppClip Card with the message: "This app clip is not currently available in your country or region" (even when I don't have AppClip installed), and Every time you test the main app, you will have to use “Clear Experience Cache”
Please help, thanks a lot.

Is there a way to integrate an Expo app with firebase dynamic links without detaching?

Is there a way to integrate an Expo app with firebase dynamic links without detaching.
If you need to create new dynamic links on the fly you could use REST API to do it. In the much more likely scenario that you only need your app to open Firebase's dynamic links, you don't need to do anything other than configuring your Expo App to handle universal links (ie: deeplinks using http/https).
The checklist is something like this:
1. Configure your app.json
For Android, add the intentFilters property to your android property:
"android": {
"intentFilters": [
{
"action": "VIEW",
"data": [
{
"scheme": "https",
"host": "<your-domain>",
"pathPrefix": "/"
},
],
"category": [
"BROWSABLE",
"DEFAULT"
],
"autoVerify": true // required to work on newer android versions
}
]
]
For iOS, add the associatedDomains property to ios:
"ios": {
"associatedDomains": ["applinks:<your-domain>"]
}
2. Configure your domain to allow links from it to be handled by the apps
Android and iOS will allow your app to open links from your domain if you serve a configuration file from a specific location:
Android: https://<your-domain>/.well-known/assetlinks.json
iOS: https://<your-domain>/.well-known/apple-app-site-association
assetlinks.json will look something like this:
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "<android-package-name>",
"sha256_cert_fingerprints":
["<your-sha256-certificate-fingerprints>"]
}
}]
And the apple-app-site-association like this:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "<your-team-id>.<ios-bundle-identifier>",
"paths": [ "*" ]
}
]
}
}
You can read more about these files here and here.
To obtain the SHA256 fingerprints of your app’s signing certificate you can use the keytool:
keytool -list -v -keystore <your-key-file>
After you enter your keystore password, it will print many of the keystore information including the SHA256 fingerprints.
If your site is hosted on Firebase both assetlinks.json and apple-app-site-association can be generated automatically if you create the Apps on your Firebase's project. Otherwise, just put these files on the root of your domain.
3. Create a Firebase dynamic link
I think this is step is mostly self explanatory but just a few notes:
Set up your short URL link: in the end you will have / that you send to your users
Set up your Dynamic Link: here you define your deelink (the link you want your app to handle)
Define link behavior for iOS: you mostly likely want to click on 'Open the deep link in your iOS App' and select your App from the list (if you haven't yet, create one App for each platform on your project)
Define link behavior for Android: same as previous but with a few more options to select
Configure (or not) campaign tracking and you're done.
Remember that you always should test your deeplinks by clicking instead of by entering directly on the browser. You may send the link to yourself on the WhatsApp or put on some notes app, for example.
Others resources that might be helpful:
https://docs.expo.io/versions/latest/workflow/linking/
https://reactnavigation.org/docs/deep-linking/
In addition to Pedro Andrade's instructions:
1.) Firebase requires the following details under your app > project settings for dynamic links to work.
Android: SHA 256 (App signing key certificate fingerprint) - this can be retrieved via play store > your app > App Integrity > SHA 256
iOS: App ID Prefix (Team ID): developer.apple.com > Certificates, Identifiers & Profiles > your app id > App ID Prefix
Surprisingly, these are mentioned almost nowhere in the docs, but do come up in stackoverflow results and other answers when googling errors that debugging preview links result in:
Android app '<bundle id>' lacks SHA256. AppLinks is not enabled for the app. Learn more.
iOS app '<bundle id>' lacks App ID Prefix. UniversalLinks is not enabled for the app. Learn more.
You can view debugging preview links by adding ?d=1 to your dynamic links.
https://firebase.google.com/docs/dynamic-links/debug
2.) Even if you use a page.link-style domain provided by firebase for your dynamic links, your associatedDomain/intentFilter domains in app.json should still be your actual domain
i.e if you're generating my-app.page.link shortLinks, that are dynamic links to my-app.com, you should use my-app.com in app.json
Pedro Andrade's solution works! Partially...
Explaining:
You must NOT add your dynamic link domain in intentFilters and associatedDomains, because it makes the app to open the link directly in the app, so, the dynamic link is not processed and you don't have access to the link generated by the dynamic link.
It works partially because of this: the dynamic link needs to be opened by the browser (chrome or safari) before being opened in the app.
Example: Open "<your-domain>.page.link/XLSj" in browser, browser will direct to generated link: "<your-domain>.com/params/54" to configured deep link.
I don't know any other way to 'read' the dynamic link by expo in managed workflow.

Deployment of ARM: Authorization failed for template resource 'sql

I try to deply SQL Server Logical server with PS and ARM. I can succesfully create logical server at portal with contributor rights, but cannot figure out what is wrong here.
I have here PowerShell ISE on Windows.
ARM template is copy and paste from https://github.com/Azure/azure-quickstart-templates/tree/master/101-sql-logical-server/
//CODE
Connect-AzAccount -Credential $Credential -Tenant $tenant -Subscription $subscription
#ARM Deployment
$templateFile = "C:\Azure\SQLServer\azuredeploy.json"
New-AzResourceGroupDeployment `
-Name SQLDeployment `
-ResourceGroupName my-rg `
-TemplateFile $templateFile
ERROR:
New-AzResourceGroupDeployment : 17.35.18 - Error: Code=InvalidTemplateDeployment; Message=The
template deployment failed with error: 'Authorization failed for template resource 'sql
vasvtmcp42o3wko/Microsoft.Authorization/11fd61df-2336-5b96-9b45-ffc7160df111' of type
'Microsoft.Storage/storageAccounts/providers/roleAssignments'. The client 'john.smith#mycompany.
com' with object id '1115f3de-834b-4d28-a48f-ecaad01e3111' does not have permission to perform action 'Microsoft.Authorization/roleAssignments/write' at scope '/subscriptions/1111111
11111111111111/resourceGroups/my-rg/providers/Microsoft.Storage/storageAccounts/sqlvasvtmcp42o3wko/providers/Microsoft.Authorization/roleAssignments/11111df
-2336-5b96-9b45-ffc7160df168'.'.
I can succesfully create logical server at portal with contributor rights, but cannot figure out what is wrong here.
Because the template you used will enable the Advanced data security for you, this will create a storage account and service principal for your sql server, then assign the service principal to the storage account as a Storage Blob Data Contributor role automatically.
To do this operation, your user account need to be the Owner or User Access Administrator in the resource group or subscription. Or you can also create a custom role which has Microsoft.Authorization/roleAssignments/write in its actions, then the role will also be able to do that.
So in conclusion, you have two options to fix the issue.
1.Navigate to the Resource group or Subscription in the portal -> Access control (IAM) -> Add -> add your user account as a role mentioned above e.g. Owner, then it will work fine. See details here.
2.When you deploy the template, specify the enableADS with false in the azuredeploy.parameters.json file. Then it will not enable the Advanced data security for you, and you will be able to create the sql server with the Contributor via the template.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"serverName": {
"value": "GEN-UNIQUE"
},
"administratorLogin": {
"value": "GEN-UNIQUE"
},
"administratorLoginPassword": {
"value": "GEN-PASSWORD"
},
"enableADS": {
"value": "false"
}
}
}
The error clearly states the account that is being used for the action doesn't have the proper role assignment to perform the action.
the client 'john.smith#mycompany. com' with object id '1115f3de-834b-4d28-a48f-ecaad01e3111' does not have permission to perform action 'Microsoft.Authorization/roleAssignments/write' at scope '/subscriptions/1111111 11111111111111
This means your next step should be validating what role assignment is assigned to that user, and then checking that the role does have the permission to perform Microsoft.Authorization/roleAssignments/write

Resources