Quickblox - create 1 to 1 chat web application - quickblox

I want to create a very basic one to one web chat application using Javascript SDK.
I followed the following link: http://quickblox.com/developers/Web_XMPP_Chat_Sample and also saw post
quickblox for web - create 1 to 1 chat
But i cannot make an application where two added users are able to chat. What i have done so far:
1. Downloaded javascript SDK.
2. Created my own Chat App as instructed and added two users to that application in dashboard.
3. Copied QBApp, QBUser1, QBUser2 credentials to the config.js inside the Samples> Chat> JS folder.
The config.js now looks like:
var QBApp = {
appId: 28143,
authKey: 'KVCCFAQXGsNRq22',
authSecret: 'VNkQ5frbgexXeqH'
};
var config = {
chatProtocol: {
active: 2,
},
debug: false
};
var QBUser1 = {
id: 5352004,
name: 'user1',
login: 'chatUser1',
pass: 'password'
},
QBUser2 = {
id: 5352010,
name: 'user1',
login: 'chatUser2',
pass: 'password'
};
I cannot establish communication with this. I think i have done something wrong in config.js entries?
Any help would be highly appreciated.

Related

Does app check check work with firebase phone auth?

I'm new to web development in general. started learning Javascript last year.
I created a website for testing. Before implementing app check, phone auth worked fine.
I'm using reCaptcha enterprise for app check.
I get this error: Uncaught (in promise) TypeError: recaptchaVerifier.render is not a function
implementing app check:
const { initializeAppCheck, ReCaptchaEnterpriseProvider } = require("firebase/app-check");
const appCheck = initializeAppCheck(firebaseApp, {
provider: new ReCaptchaEnterpriseProvider('**********************************'),
isTokenAutoRefreshEnabled: true // Set to true to allow auto-refresh.
});
My javascript code for implementing phone auth:
$('#phone-method').click(function() {
window.recaptchaVerifier = new RecaptchaVerifier('recaptcha-container', {}, auth);
// Sign in with phone flow
})
Apparently, there was a problem with enterprise but they have since fixed it:
https://github.com/firebase/firebase-js-sdk/issues/6133
Same problem to me, but this thread in Github help me:
https://github.com/firebase/firebase-js-sdk/issues/6133
Here you have a nice sample inside.
It seems that appCheck only works great with ReCaptchaV3Provider. You will just have to change:
initializeAppCheck(app, {
provider: new ReCaptchaEnterpriseProvider(*****),
isTokenAutoRefreshEnabled: true
})
to:
initializeAppCheck(app, {
provider: new ReCaptchaV3Provider(*****),
isTokenAutoRefreshEnabled: true
})
And I recommend to change the way to initialize captcha, set to invisible like this:
window.recaptchaVerifier = new RecaptchaVerifier('recaptcha-container',
{ 'size': 'invisible' },
auth);

Jitsi External API configuration

I'm new with Jitsi and I'm trying to configure the Jitsi External API on my Django project. I have created the video call as below.
const domain = 'meet.jit.si';
const options = {
roomName: 'BeehobMeetExample',
width: 1100,
height: 700,
parentNode: document.querySelector('#meet'),
userInfo: {
email: '{{request.user.email}}',
displayName: '{{request.user.first_name}} ' + '{{request.user.last_name}}',
avatarUrl: '{{ request.user.socialaccount_set.all.0.get_avatar_url }}'
},
configOverwrite: {
prejoinPageEnabled: false
},
interfaceConfigOverwrite: { TILE_VIEW_MAX_COLUMNS: 2 },
};
const api = new JitsiMeetExternalAPI(domain, options);
Now, I'm trying to set one person selected by the moderator to be a guest like a camera and audio on, and other room attendees only listeners. Also I'm trying to show the role in the userInfo. Could you please help me with these?
You can handle the buttons of the toolbar with the conditionals you need but in general, using the Jitsi iframe has its limitation because the UI and core functionalities are from Jitsi itself

`useAuthRequest` always returns `dismiss`

SDK Version: 37
Platforms(Android/iOS/web/all): Android (Expo Client)
I’m using useAuthRequest from expo-auth-session to fetch an authentication code for itsme, a Belgian OpenID Connect authentication provider. I'm using the Expo client on Android.
The code looks like this:
export default function SignUpScreen() {
const discovery = useAutoDiscovery('https://e2emerchant.itsme.be/oidc');
const [request, response, promptAsync] = useAuthRequest(
{
clientId: Itsme.CLIENT_ID,
redirectUri: makeRedirectUri(),
scopes: [
'openid',
'service:CURVO_TEST_SHAREDATA',
'profile',
'email',
'phone',
'address'
],
extraParams: {
claims: JSON.stringify({
userinfo: {
'tag:sixdots.be,2016-06:claim_nationality': null,
'tag:sixdots.be,2016-06:claim_city_of_birth': null,
'tag:sixdots.be,2016-06:claim_eid': null,
'tag:sixdots.be,2017-05:claim_photo': null
}
})
}
},
discovery
);
return (
<TouchableOpacity onPress={promptAsync}>Log in</TouchableOpacity>
);
When the “Log in” button is pressed, the following happens:
(OK) The itsme application is correctly opened. I can tell that the scopes have also been correctly communicated.
(OK) I can authenticate within the itsme application with my itsme PIN code.
(OK) The itsme application then closes, which is expected.
(OK) My app is re-opened.
(NOT OK) The response variable becomes equal to { type: 'dismiss' }.
Whatever I do, the response is always “dismiss”. I find it strange because the docs say:
If the authentication is dismissed manually with AuthSession.dismiss() , the result is { type: 'dismiss' } .
However, I never call AuthSession.dismiss().
It looks like it’s failing right at the last step, when it’s supposed to parse the authorization code out of the response URL.
I tried several things:
starting Expo in all three modes: tunnel, lan, localhost
adding a path to the redirect URI, like makeRedirectUri({ path: '/itsme' })
the AppState.currentState “trick” described in a (related?) GitHub issue.
None of these tries worked and I’m out of ideas. Any thoughts or suggestions? Or maybe how to debug inside `expo-auth-session to see what’s going on?
Thank you in advance.

Multiple realms in React Native don't query realm object server correctly on first launch of app after install

I am having an issue dealing with multiple realms in React Native. I'm working on an app that allows users to use the app without having a subscription (using a local realm) and then at any point in their app journey they have the option of upgrading to a subscription with syncing (which uses sync to a realm object server).
When I start the app I check to see if they are using sync and if so I initialize a synced realm with their user and everything works great. I get all the data I expect.
However, when the app starts on first launch after install (that part about first launch after install is crucial) and I see that they don't use sync I initialize a local realm which I save data to until they decide to log in to their sync account (if they have one). At this point I attempt to pull information from the synced realm but it does not have the information that I saw when I only initialized the synced realm (in the case that on app startup I detect they use sync).
I am able to log in as the sync user but the data isn't there if I've previously initialized a local realm AND this logic gets run on the first launch of the app after install. The data only shows up from the realm object server when I initialize a local and synced realm on a secondary launch of the app (no reinstall before launching).
Here's a simple test script with dummy data in it with which I've been able to replicate the observed behavior:
const username = 'testuser2';
const password = 'supersecret';
const tld = 'REALM_OBJECT_SERVER_TLD';
class Test extends Realm.Object {}
Test.schema = {
name: 'Test',
properties: {
id: {
type: 'string',
},
}
};
function initLocalRealm() {
return new Realm({
path: 'local.realm',
schema: [Test],
});
}
function initSyncedRealmWithUser(user) {
return new Realm({
path: 'synced.realm',
sync: {
user,
url: `realm://${tld}:9080/~/data`,
},
schema: [Test],
});
}
function writeTestObjectWithId(realm, id) {
realm.write(() => {
realm.create('Test', {
id,
});
alert(`Test object with id: ${id}`);
});
}
initLocalRealm();
// setup
// uncomment this and comment out the login section to setup user on first run
// Realm.Sync.User.register(`http://${tld}:9080`, username, password, (error, user) => {
// if (error) {
// return;
// }
// const syncedRealm = initSyncedRealmWithUser(user);
// writeTestObjectWithId(syncedRealm, '1');
// });
// login
Realm.Sync.User.login(`http://${tld}:9080`, username, password, (error, user) => {
if (error) {
return;
}
const syncedRealm = initSyncedRealmWithUser(user);
alert(`Synced realm test objects: ${syncedRealm.objects('Test').length}`);
});
If you create a react native app and then add this code to the main components componentDidMount function you should see that on the first run of the app (after you've uncommented the register code once) you will see the Test collection length at 0, but then when you refresh you will see the Test collection length at 1.
Any help on this would be awesome.
Thanks!
running your code snippet, I get a length of 1 immediately as soon as I uncomment the login section. Could you try observing your synchronized realm with the Realm Browser and see if it seems to have the data you are expecting after registering the user?

Remember login in Sencha 2 app

We dont want the user to log in each time he/she opens our Sencha 2 app. Its not determined yet if we will serve it through a web browser or package it as a native app with the Sencha build tool.
Any advices how to solve it? Should I use some local storage to remember if user has logged in?
I have created a Simple Login project on github to illustrate how I'm using localStorage in credential saving. Feel free to use ideas in your project. Feedback & comment are welcome
Cheers, Oleg
Here i am going to save the username and password values with the id of 'ext-record-2'.
if (values.keepUser) {
var user = Ext.create('MyApp.model.LoginLocalSave', {
id: 'ext-record-2',
uemail: values.uname,
pword: values.pword,
isRemember: values.keepUser
});
user.save();
}
On launching of login screen we need to read the username and password fields from the local storage by using the previously save id 'ext-record-2' and display it on the fields.
launch: function() {
var User = Ext.ModelMgr.getModel('MyApp.model.LoginLocalSave');
User.load('ext-record-2', {
success: function(user) {
Ext.ComponentQuery.query('formpanel #uname')[0].setValue(user.get('uemail'));
Ext.ComponentQuery.query('formpanel #pword')[0].setValue(user.get('pword'));
Ext.ComponentQuery.query('formpanel #keepUser')[0].setValue(user.get('isRemember'));
},
failure: function() {
console.warn('Auto-fill login failed.');
}
});
},
Please visit the below url for full source code by clicking the link. [Solved by solution]
http://saravanakumar.org/blog/2014/04/login-screen-with-username-and-password-remember-in-sencha-touch/