I am using the ConnectyCube React Native SDK but not getting very far with it. When using its methods I am getting and error saying they are undefined like so: TypeError: Cannot read property 'createSession' of undefined
. When I console.log ConnectyCube.createSession
it logs:
ƒ createSession(params, callback) {
this.auth.createSession(params, callback);
}
.
I have linked the package using react-native link connectycube-reactnative
as I've read to do on other posts, but am still having the same problem. Anyone know what's wrong or how I could fix? Thanks in advance.
import ConnectyCube from 'connectycube-reactnative'
import config from './ConnectycubeConfig'
export default function App() {
console.log(ConnectyCube.createSession)
var userCredentials = {login: 'xxxxxxxxx', password: 'xxxxxxxx'};
ConnectyCube.createSession(userCredentials, (error, session) => {
}); // 'TypeError: Cannot read property 'createSession' of undefined'
Please set it up and proceed
with the session
.
import ConnectyCube from 'connectycube-reactnative'
...
const cbConfig = [
{
appId: 218,
authKey: 'p-cqm2aatn8ZPM3',
authSecret: '3hmGuXN8AHZOgg6',
},
{
debug: { mode: 1 },
},
]
...
componentWillMount() {
ConnectyCube.init(...cbConfig)
ConnectyCube.createSession((failSession, session) => {
if (!failSession, session) {
alert("you can get login")
}
})
}