how to add occupants/users to a MUC room? - ejabberd

I have created a persistent MUC room using the ejabberd API "create_room_with_opts". I am now adding a user to the room by subscribing the user to the room using "subscribe_room" API with folowwing req and response.
Req:
{
"user": "vishesh#dub/dummy",
"nick": "vish",
"room": "roomdub#conference.dub",
"nodes": "urn:xmpp:mucsub:nodes:messages,urn:xmpp:mucsub:nodes:affiliations,urn:xmpp:mucsub:nodes:subject,urn:xmpp:mucsub:nodes:presence"
}
Res:
[
"urn:xmpp:mucsub:nodes:messages",
"urn:xmpp:mucsub:nodes:affiliations",
"urn:xmpp:mucsub:nodes:subject",
"urn:xmpp:mucsub:nodes:presence"
]
But when I list the number of occupants it lists as 0. I used "get_room_occupants_number" API which had following req and res.
Request:
{
"name": "roomdub",
"service": "conference.dub"
}
Response:
{
"occupants": 0
}
I am unable to understand why I don't see the user I added? Did I miss any step?

An account can be a room "subscriber", and receive notifications, and can also sends messages to the room. As described in https://docs.ejabberd.im/developer/xmpp-clients-bots/proposed-extensions/muc-sub/
Alternatively (or simultaneously), the account can be a room "occupant", and can see other room occupants' presence, how they join and leave, receives messages, private messages and can also send them. As described in https://xmpp.org/extensions/xep-0045.html
So, this sentence is wrong:
I am now adding a user to the room by subscribing the user to the room
You are not "adding" the user to the room, because after all that concept is not define in any of the protocols I mentioned. You are "subscribing" it to some room events. And doesn't make him an "occupant".

Related

Unable to retrieve Claims in either the id_token or userinfo requests

I'm trying to retrieve the CIF and also the Tax Id of the logged in user following your documentation. When trying to request that information via additional claims via the Consumer API, with the scope of &scope=openid I'm supplying the below claims parameter in my authorization request. Making sure that the External App is configured with the claims access in the Banno portal, I don't get anything in my response id_token. I've also attempted to switch this to the userinfo leveraging the opid/me resource which just returns the user "sub".
Claims readable:
claims={"id_token":{"https://api.banno.com/consumer/claim/customer_identifier":null}}
Here it is url encoded:
claims==%7B%22id_token%22%3A%7B%22https%3A%2F%2Fapi.banno.com%2Fconsumer%2Fclaim%2Fcustomer_identifier%22%3Anull%7D%7D
decoded jwt id_token repsonse:
"id_token": {
"header": {
"alg": "RS256",
"typ": "JWT",
"kid": "sig-rs-0"
},
"body": {
"sub": "sub uuid",
"at_hash": "ShHf2gRtROCBdE-j_5YZkw",
"aud": "aud uuid",
"exp": 1668092577,
"iat": 1668088977,
"iss": "https://api.banno.com/a/consumer/api/v0/oidc"
}
}
using the same example switching the claims key to "userinfo" and making a request to .../a/consumer/api/v0/oidc/me I only get this response:
UserInfo Response:
{"sub":"sub uuid"}
In either scenario, I'm expecting the following example to be in the response:
"https://api.banno.com/consumer/claim/customer_identifier": "AAA1234",
However I don't get anything no matter what I do. What am I missing here?
It looks like there is an extra = in the encoded version. If I take what you've posted in the question, claims==%7B%22id_token%22%3A%7B%22https%3A%2F%2Fapi.banno.com%2Fconsumer%2Fclaim%2Fcustomer_identifier%22%3Anull%7D%7D and decode it, I get claims=={"id_token":{"https://api.banno.com/consumer/claim/customer_identifier":null}}, which has an extra = next to the claims parameter name.
That seems to have the effect of the name of the claim not matching up with what is expected, therefore that claim's value is not included in the Identity Token (and isn't available from the UserInfo endpoint).
The Claims in the Identity Token guide will be helpful to review.

Magneto Rest API to Update Tracking Number and Carrier Code is not working

I tried to update the tracking no and carrier code using the following API with the payload.
http://example.com/rest/default/V1/shipment/track
Payload
{
"entity":{
"order_id":63,
"entity_id":26,
"parent_id":26,
"weight":2,
"qty":1,
"description":"This is testing trackig no",
"extension_attributes":{
},
"track_number":"333333",
"title":"United Parcel Service",
"carrier_code":"United Parcel Service"
}
}
The above API is found in the documentation link given below.
https://magento.redoc.ly/2.4.3-admin/tag/shipmenttrack
The shipment is done through Magento UI but tracking number and carrier code is not updated.
so I use the Rest API to Update the tracking number and carrier code with the above API.
As per documentation, It has quantity and weight. if I a ship has more than one item, should we give total quantity and weight.
It gives the response with 200 OK but Magento UI is not showing the tracking details.
Is there any restriction to update tracking when order is complete.
It is not working even when the order is "Processing"
Please advise.
Thanks
Rajan
POST URL : https://example.com/index.php/rest/V1/shipment/track
Please try the following payload,
{
"entity": {
"order_id": 1232,
"parent_id": 1234,
"track_number": "96867546342",
"title": "Delhivery",
"carrier_code": "custom"
}
}

Duplicate Registration of the same Yubikey U2F device

I have a doubt. I have set a complete solution around the Yubico U2F keys. But now, I cannot stop duplicate registration of the same device for an user for the same app id. While checking on the keyhandles on my database they show different values for each of the duplicate registration. Please help me out.
If you are using the WebAuthn API, you can send all the already registered keys to the client when trying to add a new key using the 'excludeCredentials' key. These credentials would be formatted the same as when trying to log in.
excludeCredentials — Contains a list of credentials that were already
registered to the user. This list is then given to the authenticator,
and if the authenticator recognises any of them, it cancels operation
with error CREDENTIAL_EXISTS, thus preventing double registration of
the same authenticator.
Source: https://medium.com/#herrjemand/introduction-to-webauthn-api-5fd1fb46c285
An example of the JSON the client receives when adding a new key could be:
{
"publicKey":{
"rp":{
"name":"YourApp",
"id":"YourAddress"
},
"authenticatorSelection":{
"userVerification":"preferred"
},
"user":{
"id":"UserId",
"name":"Username",
"displayName":"displayName"
},
"pubKeyCredParams":[
{
"type":"public-key",
"alg":-7
}
],
"attestation":"direct",
"extensions":{
"exts":true
},
"timeout":20000,
"challenge":"...",
"excludeCredentials":[
{
"id":"...",
"type":"public-key",
"transports":[
"usb",
"ble",
"nfc",
"internal"
]
},
{
"id":"...",
"type":"public-key",
"transports":[
"usb",
"ble",
"nfc",
"internal"
]
}
]
}
}
When the browser detects that the user tries to register a key that was already registered, it will tell the user to try another key and the request will not be sent to the server at all.

Microsoft Graph does not retrieve the Group's Plan Id

After creating a Group using POST /v1.0/groups with the body:
{
"description": "hello",
"displayName": "group_for_restore",
"groupTypes": [
"Unified"
],
"mailEnabled": true,
"mailNickname": "group_for_restore",
"securityEnabled": false,
"visibility": "Public"
}
A request to GET /v1.0/groups/{group-id}/planner/plans does not retrieve any plans.
As far as I know, after creating a Group, a Plan will be created too. On the web interface you can see that this plan is correctly created and shown, but it does not appear in JSON response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.plannerPlan)",
"#odata.count": 0,
"value": []
}
After clicking on it in the web interface you can easily get the plan using the request above.
Is it ok to do such magic steps to fetch plan id?
The Web App is provisioning the Group's Plan the first time you attempt to access it. When creating a Group through the API however, you'll need to create a new Plan yourself:
POST https://graph.microsoft.com/v1.0/planner/plans
Content-type: application/json
{
"owner": "group-id",
"title": "title-value"
}
Keep in mind this important note from the documentation:
When creating a new plan, make a group its owner by simply setting the owner property on a plan object.

How do you cancel a PayPal subscription through their api?

On this page:
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECRecurringPayments
it says that it's possible to cancel a PayPal subscription using their API. Knowing the SubscriptionId can anyone give me some code example how to do this?
Many thanks.
Did you manage to find an easy solution ? I'm looking for this as well. Thanks!
Update : After searching, the "ManageRecurringPaymentsProfileStatus" is very easy to use through a simple POST request.
Make sure that your user, password or signature are not visible (in other words, do this on your server and NOT on your client via javascript or html posts).
Below a simple working example in Python. It works and I'm now using it daily.
import urllib
from google.appengine.api import urlfetch
form_fields = {
"METHOD": "ManageRecurringPaymentsProfileStatus",
"PROFILEID": "xxx", # put your subscription ID here
"ACTION": "cancel",
"USER": "xxx", # Get USER, PWD, and SIGNATURE from your Paypal's account preferences
"PWD": "xxx",
"SIGNATURE": "xxx",
"VERSION": "54.0"
}
api_url = 'https://api-3t.sandbox.paypal.com/nvp' # remove the sandbox part for production
form_data = urllib.urlencode(form_fields)
result = urlfetch.fetch(url=api_url,
payload=form_data,
method=urlfetch.POST,
headers={'Content-Type': 'application/x-www-form-urlencoded'})
The response is a string that looks like this:
TIMESTAMP=2011%2d01%2d28T14%3a47%3a45Z&CORRELATIONID=148ebe1d25566&ACK=Failure&VERSION=54%2e0&BUILD=1704252&L_ERRORCODE0=11552&L_SHORTMESSAGE0=Invalid%20profile%20ID&L_LONGMESSAGE0=The%20profile%20ID%20is%20invalid&L_SEVERITYCODE0=Error
The 'ACK' field indicates 'Failure' or 'Success'.
In answer to comments below, note that it DOES enable me to cancel the subscriptions that have been created through a dynamically created link such as :
Subscribe
Note that I do not use the flag 'modify' at all.