Closed Jempan closed 3 years ago
Please try something like this:
ConnectyCube.init(config)
ConnectyCube.createSession().then(session => {
ConnectyCube.login(userCredentials)
.then((user) => {})
.catch((error) => {});
}) .catch(error => {
});
Thanks for your answer! Tried your suggested way of creating a session but the answer from your server is catched as an error even though the status code is 201 (created). So the ConnectyCube.login line never happens. Anyway I want to use our own user database and authentication system and then I can't log users in that way can I?
When I follow the instructions on https://developers.connectycube.com/guides/custom-identity-provider I get "token is required" on the login post request which makes sense since your server could not know who I am. Is that response not referring to a session token?
Please try the following:
ConnectyCube.init(config)
ConnectyCube.createSession(userCredentials).then(session => {
}) .catch(error => {
});
Now I get a 401-error back without any more info. Which userCredentials do you want me to try here?
The same what you pass into login
request
Please provide the following:
1) what params you pass in userCredentials
2) What exact error you receive?
3) what you defined as Custom Identity Provider settings in admin panel
It's working now. I can see in our log that the verification call from ConnectyCube reaches the right endpoint on our server and the custom user is also added to the user list in your admin panel. Does this mean that i don't have to do the login post call described in https://developers.connectycube.com/guides/custom-identity-provider?
ConnectyCube.createSession(userCredentials).then(session => {
console.log("VideoService initialized and session created "+JSON.stringify(session))
}).catch(error => {
console.log("VideoService initialized error "+JSON.stringify(error))
});
Above call gives me VideoService initialized error {"code":201,"info":" "}
but if I don't need any information from the session object I guess it doesn't matter :)
It's totally fine to use single ConnectyCube.createSession(userCredentials)
instead of creating an empty session and then user login, so this should be fine 👍
Trying to start a video conference and updated above code to:
ConnectyCube.createSession(userCredentials).then(session => {
console.log("VideoService initialized and session created "+JSON.stringify(session));
}).catch(error => {
console.log("VideoService initialized error "+JSON.stringify(error));
this.videoConference = ConnectyCube.videochatconference.createNewSession();
});
but I get an error "Error: Session does not exist at ConferenceClient.getCurrentSessionToken". Is the session I started not good for video conferences?
Could you please try the following:
ConnectyCube.createSession(userCredentials).then(session => {
console.log("session resp", session);
console.log("session", ConnectyCube.sdkInstance.session);
this.videoConference = ConnectyCube.videochatconference.createNewSession();
}).catch(error => {
console.log("session error", error);
});
you should create a conf session once you got a success session, not inside catch
error callback
Hi again and thanks for your reply! If you look at my comment 21 hours ago you can see that when I use your library ConnectyCube.createSession(userCredentials) it returns in the catch error clause and logs error {"code":201,"info":" "} and I don't get a session object back. Has no one else experienced that before, could it be because I use the custom identity provider option?
@Jempan I'm not sure I can understand what's wrong
Can you do one thing - open browser's console, network tab Then copy past a screenshot of the response obtained for the session creation request - both body and headers
It will help to understand what's going on
Total mystery.. Status code is 201 but no body
One thing to try - could you please try to use Chrome browser standard debugger, not a React Native debugger and let us know how it works.
Here is the full response header also.
Yes headers are fine, status code is good as well (201) And there should be a response body for sure
Also please provide your app id we will check against backend logs what can be an issue
Yes it's very strange. Unfortunately I have never been able to debug this app using chrome browser standard debugger, network calls doesn't work without react native debugger :( Where can I give you my app id without posting it in the open here? Maybe you can identify me in the logs now that you have the exact time of the call?
Ok we identified it
we see your backend responses with '415 Unsupported Media Type' error when we do a request to it to verify the data
Could you please double check this part and adjust custom idp settings in admin panel
maybe it's required to add some request headers there e.g. https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/415
That's even stranger, my server log shows the request from you guys without any errors and response code 200 🤔 And the custom user was also created in the admin user list which I guess shouldn't happen if you didn't get a 200 response?
Do you have anymore information about the request from your side. This is what I can se in my logs and it looks correct 🤔
Tried to add many different combinations of headers without any luck. Still can't see any info about 415-errors in my server log, only 200 responses. One question, when I change the settings (for example header) in your admin can I test it directly or does the changes takes time to go through?
Tested that I get a 200 response with a uid in the response when I call my endpoint from postman and copied the same headers to your admin but it still not work. Don't know what else to test without more info from you.
@Jempan please let us know what's your app id
@DaveLomber Sent my app id to your support email now.
Ok we just checked the logs
We see 3 requests with errors: 2 with '500 Internal Server Error' and one is with '401 Unauthorized'
all the rest obviously was ok
@Jempan we also enabled additional logging Please repeat a couple of times the request and let us know We will check for more
@DaveLomber Thanks a lot 🙏 Since I tested many different combinations both on my server and with your admin settings it's not surprising that you see some 500 and 401 errors. I just ran 2 request now again, one with the ConnectyCube.videochatconference.createNewSession() line added one without. I get the same behaviour described above 201 created but empty and Error: Session does not exist at ConferenceClient.getCurrentSessionToken. Hope you can see something helpful in your additional logs ✊
@Jempan We do not see any wrong behaviour in logs
Could you please do us a favour and try 2 things:
1) disable custom identity provider and perform
ConnectyCube.createSession().then(session => {
console.log(session)
})
is session is here?
2) and now enable again custom identity provider and try the same
Hi again @DaveLomber! I tried to disable/enable custom identity provider and creating the session in all suggested different ways. Still the same problem, 201 session created but empty response. I also tried with your test credentials in the example app and finally ran the example app which gave me the same 201 session created but empty response problem as I have with my own app.
Then tried to run the example app without debugging in React Native Debugger and bam, that worked, the session was created and returned!! Even more specific it looks like your library does not work when Network Inspect in React Native Debugger is enabled.
What about using Refresh Tokens?
Hi @Jempan and @DaveLomber , I also need to implement ConnectyCube using our server user base and I am also trying to implement it by following below steps but, I am getting 401 as login response with ConnectyCube login and when tried with ConnectyCube.login() method I am getting 404 as Response status code:
Can you please suggest what could be a reason for that?
Steps I followed: (All in React-Native project)
Params: const userCredentials = { login: 'XXXXXX', password:'XXXXXX', };
Response: {"id":15143047,"user_id":0,"application_id":XXXX,"nonce":8133,"token":"XXXXXXXXXXXXXXXXXXXXXXXXXX","ts":1594730932,"created_at":"2020-07-14T12:48:54Z","updated_at":"2020-07-14T12:48:54Z"}
Request Params: const userCredentials = { login: 'XXXXXX', password:'XXXXXX', keys: { token:"XXXXXXXXXXXXXXXXXXXXXXXXXX" } }; //Token received from CreateSession Method
Response: Connecty cube user error {"code":404,"info":" "}
And when we used API to login it gives:
Request Params: const userCredentials = { login: 'XXXXXX', password:'XXXXXX', keys: { token:"XXXXXXXXXXXXXXXXXXXXXXXXXX" } }; //Token received from CreateSession Method
Response: Request failed with code 401
As per the doc we should do this: POST https://api.connectycube.com/login login=IP_user_id //This we are getting as 0 from createSession response. password=IP_token
Note: But in our case we have used request params as we are not receiving user_id as 0 after creating session.
Hi! Following the instructions for external authentication via Custom Identity Provider at https://developers.connectycube.com/guides/custom-identity-provider but feel that some information is missing. The call to https://api.connectycube.com/login obviously requires a "token". Is it an application session token and if so how can I retrieve it? Trying to run:
ConnectyCube.init(config)
ConnectyCube.createSession() .then((session) => {}) .catch((error) => {});
But I don't get any session information back. Guess I misunderstood something?
You are asking is it an application session token
and asking about what the token
is. Did you find the answer and if so, what was the answer, which token?
I see that in this diagram it shows that you receive a "token" from your backend:
How do you get a "token" from your backend, my backend doesnt send any tokens and it's not explained...
Hi @Jempan and @DaveLomber , I also need to implement ConnectyCube using our server user base and I am also trying to implement it by following below steps but, I am getting 401 as login response with ConnectyCube login and when tried with ConnectyCube.login() method I am getting 404 as Response status code:
Can you please suggest what could be a reason for that?
Steps I followed: (All in React-Native project)
- ConnectyCube.init(config)
- ConnectyCube.createSession() .then((session) => {}) .catch((error) => {});
Params: const userCredentials = { login: 'XXXXXX', password:'XXXXXX', };
Response: {"id":15143047,"user_id":0,"application_id":XXXX,"nonce":8133,"token":"XXXXXXXXXXXXXXXXXXXXXXXXXX","ts":1594730932,"created_at":"2020-07-14T12:48:54Z","updated_at":"2020-07-14T12:48:54Z"}
- ConnectyCube.login() .then((user) => {}) .catch((error) => {});
Request Params: const userCredentials = { login: 'XXXXXX', password:'XXXXXX', keys: { token:"XXXXXXXXXXXXXXXXXXXXXXXXXX" } }; //Token received from CreateSession Method
Response: Connecty cube user error {"code":404,"info":" "}
And when we used API to login it gives:
Request Params: const userCredentials = { login: 'XXXXXX', password:'XXXXXX', keys: { token:"XXXXXXXXXXXXXXXXXXXXXXXXXX" } }; //Token received from CreateSession Method
Response: Request failed with code 401
As per the doc we should do this: POST https://api.connectycube.com/login login=IP_user_id //This we are getting as 0 from createSession response. password=IP_token
Note: But in our case we have used request params as we are not receiving user_id as 0 after creating session.
0) Authentication via external identity provider guide 1) ConnectyCube.createSession() to create an empty session (code snippet from guide) 2) Do login in your Backend and receives a token (or any data that can be used to confirm user auth on your BE) 3) Login to ConnectyCube with data received from your Backend - ConnectyCube.login(someLoginDataObject). The ConnectyCube API will request your BE (pointed in the ConnectyCube Admin panel) and would send your the session (with your user) after gets a successful verification from your BE.
How do you get a "token" from your backend, my backend doesnt send any tokens and it's not explained...
Any data to verify your user.
@NeenaMishra12 did everything work out or you still need help?
Hi! Following the instructions for external authentication via Custom Identity Provider at https://developers.connectycube.com/guides/custom-identity-provider but feel that some information is missing. The call to https://api.connectycube.com/login obviously requires a "token". Is it an application session token and if so how can I retrieve it? Trying to run:
ConnectyCube.init(config)
ConnectyCube.createSession() .then((session) => {}) .catch((error) => {});
But I don't get any session information back. Guess I misunderstood something?