Ejabberd- set vard for other user - ejabberd

Is it possible to add a vcard for some other jabber user in ejabberd. I am logged in as admin#domain.com. While creating users in my website i am registering a jabber account for the same user. Now i need to add vcards for those users. While trying to add vcard for a new user, i can see that the vcard entry is added to the currently logged in user(in my case it is admin#domain.com). I am using strophe library and the code used for adding vcard is as follows.
iq = $iq({ type: 'set', to: 'user#domain.com' }).c('vCard', { xmlns:'vcard-temp' }).c('PHOTO').c('EXTVAL', 'http://image_url/image.jpg');
conn.sendIQ(iq);
But i can achieve the same using
ejabberdctl set_vcard jabber_id domain PHOTO img.jpg from CLI
The purpose is to add profile images to users. I have the profile images saved in my server for each users registered in my site. Currently i am doing an ajax call for fetching the user profile image. Is there any alternative for this? Any help will be really appreciable.

XMPP protocol does not define a way to edit vcard for other users and ejabberd does not implement something special to allow this.
You can use a database backend for Vcard or write a custom Vcard backend plugin to suit your needs.

Related

Simple Esri/ArcGIS Online connection using a link or iframe

I was asked by a potential client if I can have my software interact with Esri/ArcGIS Online.
Use case: users is logged into SomeRandomSoftwareApp and is looking at a Widget, this Widget includes an Esri asset id, the user clicks a link that passes that ID to Esri/ArcGIS Online and behind the scenes the user is logged into Esri and they see the data associated with the Esri/ArcGIS Online.
Thanks, Keith
If I understand correctly, you have two options for this: API Keys or Application Credentials.
The first one, is a permanent token generated by the owner of the data that will allow the application easy access to it. This is still in beta, and it was not ready for use the last time I check some time ago.
The second one, the owner of the data will generate credentials for your application. With this credentials you will have to request a token each time you want to access the data, all this via OAuth 2.0.
Check the docs for more details ArcGIS Services - Security

How do I add a custom field for a new Okta app integration?

I am creating a new Okta integration for our app and need to require users to enter a subdomain, where can I do this? We will be using SAML.
As you can see in this example for the slack integration ( http://ronz.io/gPgAeS), they are able to add a custom field to allow for the domain or subdomain to be entered.
Where in the setup can I add this? So that Okta users can enter their subdomain for our app when adding the application.
Please let me know if you need any additional context.
I'm guessing this is a custom application rather than an app in the OIN ? In which case you need to build a SAML templated app, which will allow you to add as many attributes required by the SP.
If you go to Applications -> Add Applications -> There should be a Create button on the page allowing you to define your app.

register a user in converse.js to ejabberd server using javascript

how to register an user using converse.js to ejabberd from javascript instead of using register form of converse.js. I want to register the user using converse.js api instead doing it manually from the form. Please help me with your suggestions.
Converse.js supports XMPP-0077 in band registrations to allow users to manually register new accounts for themselves.
It should be possible to also do the same thing automatically/programmatically instead of expecting the user to do it.
However, you would need to write new code to do this.
Instead of letting the user specify their username and password, you would generate and then send those values to the XMPP server automatically with Javascript.
However, a better and more secure way would most likely be to do this server-side. Either by using a RESTful API provided by the XMPP server (some do, but not all), or by creating a server-side XMPP client which does the registration.

JSON API Error - You need to login with a user that has 'edit_posts' capacity

I'm building an app on angular and ionic, I'm trying to access my WordPress and create new post.
I've generated auth cookie using JSON API User plugin (https://wordpress.org/plugins/json-api/)
I've got a valid nonce to create posts.
I'm using all the right parameter to create new post:
$http.post(domain+'/posts/create_post?nonce='+nonce.nonce+'&title='+title+'&content='+content+'&status='+status+'&author='+author)
But when I've tried to insert new post i get this massage:
"Error: You need to login with a user that has 'edit_posts' capacity"
i've that i need to add the cookie parameter to the header request, but i don't understand how.
Please help me to solve this :)
This is about the user's role, not the the auth cookie. The auth cookie would login the user, but their roles and capabilities are stored in the database. There are many ways to change the user's role, including going into the Admin Dashboard as as admin, clicking Users, the user's name, and selecting "Editor" [or whatever is appropriate] in the drop down menu.
For complete details, see https://wordpress.org/support/topic/error-you-need-to-login-with-a-user-that-has-edit_posts-capacity.
But just in case you are having issues with cookie:
Cookie need to be added to the headers like this:
Header:Cookie
Value:<cookie_name>=<cookie>
Also, if you are testing via Postman app from chrome, make sure to enable sending restricted headers (since "Cookie" is a restricted header, for more info see https://www.getpostman.com/docs/requests)

How should I managed a database for register/log in with Facebook & Twitter

I am creating an iOS App which the user will be able to login to via his account with our website (internal), or via Facebook or Twitter.
What I would like to know is how should I manage the database in order to verify his Facebook / Twitter account with his internal account on my website?
I.e When the user logs in via his internal account, I just run a simple authentication check to see if his username and password are valid. However with Facebook and Twitter, I obviously can't do this as I don't have access to the user's password.
Thanks in advanced.
my suggestion is that you would create a new table for each of the login types and connect it to your users/members table.
for example - for facebook login you would have a facebook_users table to hold the user's data (such as name, pic and most important - fbid)
than add a column named facebook_user_id to your existing members table.
in order to get the logged user from facebook you don't need to access his password... you should use the Facebook JS SDK and specifically the FB.getLoginStatus and FB.login function...
offcourse my suggestion is only one of many applicable ways to accomplish the task
Save fbid instead of fb-login user_name (you can keep both) of the user in your internal login table - A unique mapping exists (I'm sure something similar exists for twitter as well). Why do you need fb password for it?
Moreover, you run the check on internal table to authenticate user account, but when using login from fb or twitter, isn't the user already authenticated?