Failed to connect to OpenTok. Response code: Authentication failed while creating a session
I am trying to integrate video call to my web application implemented using Ruby on Rails and opentok. Currently the app throws an error for "Create Session"
Failed to connect to OpenTok. Response code: Authentication failed while creating a session. API Key: 3548532
class RoomsController < ApplicationController
before_filter :config_opentok,:except => [:index]
require "opentok"
def index
@rooms = Room.where(:public => true).order("created_at DESC")
@new_room = Room.new
end
def create
api_key = "3548532" # Replace with your OpenTok API key.
api_secret = "my secret key" # Replace with your OpenTok API secret.
opentok = OpenTok::OpenTok.new api_key, api_secret
session = opentok.create_session :media_mode => :routed
session_id = session.session_id
params[:room][:sessionId] = session.session_id
@new_room = Room.new(params[:room])
respond_to do |format|
if @new_room.save
format.html { redirect_to("/party/"+@new_room.id.to_s) }
else
format.html { render :controller => ‘rooms’, :action => “index” }
end
end
end
def party
@room = Room.find(params[:id])
@tok_token = @opentok.generate_token @room.sessionId
end
end
Party.html.erb:
<div id="invitation">Invite your friends! Share the url of this page http://localhost:3030/party/<%= @room.id %></div>
<div id="videobox">
</div>
<script src="http://static.opentok.com/v0.91/js/TB.min.js" type="text/javascript"></script>
<script type="text/javascript">
var apiKey = 3548532;
var sessionId = "<%= @room.sessionId %>";
var token = "<%= @tok_token %>";
var session;
TB.setLogLevel(TB.DEBUG);
//session.connect(apiKey, token);
var session = TB.initSession(sessionId);
session.addEventListener('sessionConnected', sessionConnectedHandler);
session.addEventListener('streamCreated', streamCreatedHandler);
session.connect(apiKey, token);
var publisher;
function sessionConnectedHandler(event) {
publisher = TB.initPublisher(apiKey, 'videobox');
session.publish(publisher);
// Subscribe to streams that were in the session when we connected
subscribeToStreams(event.streams);
}
function streamCreatedHandler(event) {
// Subscribe to any new streams that are created
subscribeToStreams(event.streams);
}
function subscribeToStreams(streams) {
for (var i = 0; i < streams.length; i++) {
// Make sure we don't subscribe to ourself
if (streams[i].connection.connectionId == session.connection.connectionId) {
return;
}
// Create the div to put the subscriber element in to
var div = document.createElement('div');
div.setAttribute('id', 'stream' + streams[i].streamId);
document.body.appendChild(div);
// Subscribe to the stream
session.subscribe(streams[i], div.id);
}
}
</script>
Why is the authentication failing?
I trying to follow the instructions from https://github.com/loganathan-s/vide0-chat-using-tokbox
Thank you
ruby-on-rails opentok
add a comment |
I am trying to integrate video call to my web application implemented using Ruby on Rails and opentok. Currently the app throws an error for "Create Session"
Failed to connect to OpenTok. Response code: Authentication failed while creating a session. API Key: 3548532
class RoomsController < ApplicationController
before_filter :config_opentok,:except => [:index]
require "opentok"
def index
@rooms = Room.where(:public => true).order("created_at DESC")
@new_room = Room.new
end
def create
api_key = "3548532" # Replace with your OpenTok API key.
api_secret = "my secret key" # Replace with your OpenTok API secret.
opentok = OpenTok::OpenTok.new api_key, api_secret
session = opentok.create_session :media_mode => :routed
session_id = session.session_id
params[:room][:sessionId] = session.session_id
@new_room = Room.new(params[:room])
respond_to do |format|
if @new_room.save
format.html { redirect_to("/party/"+@new_room.id.to_s) }
else
format.html { render :controller => ‘rooms’, :action => “index” }
end
end
end
def party
@room = Room.find(params[:id])
@tok_token = @opentok.generate_token @room.sessionId
end
end
Party.html.erb:
<div id="invitation">Invite your friends! Share the url of this page http://localhost:3030/party/<%= @room.id %></div>
<div id="videobox">
</div>
<script src="http://static.opentok.com/v0.91/js/TB.min.js" type="text/javascript"></script>
<script type="text/javascript">
var apiKey = 3548532;
var sessionId = "<%= @room.sessionId %>";
var token = "<%= @tok_token %>";
var session;
TB.setLogLevel(TB.DEBUG);
//session.connect(apiKey, token);
var session = TB.initSession(sessionId);
session.addEventListener('sessionConnected', sessionConnectedHandler);
session.addEventListener('streamCreated', streamCreatedHandler);
session.connect(apiKey, token);
var publisher;
function sessionConnectedHandler(event) {
publisher = TB.initPublisher(apiKey, 'videobox');
session.publish(publisher);
// Subscribe to streams that were in the session when we connected
subscribeToStreams(event.streams);
}
function streamCreatedHandler(event) {
// Subscribe to any new streams that are created
subscribeToStreams(event.streams);
}
function subscribeToStreams(streams) {
for (var i = 0; i < streams.length; i++) {
// Make sure we don't subscribe to ourself
if (streams[i].connection.connectionId == session.connection.connectionId) {
return;
}
// Create the div to put the subscriber element in to
var div = document.createElement('div');
div.setAttribute('id', 'stream' + streams[i].streamId);
document.body.appendChild(div);
// Subscribe to the stream
session.subscribe(streams[i], div.id);
}
}
</script>
Why is the authentication failing?
I trying to follow the instructions from https://github.com/loganathan-s/vide0-chat-using-tokbox
Thank you
ruby-on-rails opentok
TokBox Developer Evangelist here. It looks like you're using an older version of the API and the link you're referring to is not an official TokBox repo. I recommend checking out the following repo: github.com/opentok/OpenTok-Ruby-SDK/tree/master/sample/…
– Manik
Nov 13 '18 at 1:49
I have looked at the above link. The example is in Sinatra framework. I am not familiar with the framework and I am building on rails. Is there any documentation available for rails? Thank you so much for your help
– Uma Senthil
Nov 13 '18 at 2:54
Hi Uma, I've answered the question below with a code sample - hope it helps!
– Manik
Nov 13 '18 at 5:06
Hi Manik, Also I think my issue was that I used my account API key and Secret key. It seems that I must have created a project and generate API key and secret key for that project and used that pair(instead of the account pair) to create the session.
– Uma Senthil
Nov 13 '18 at 20:04
1
Hi Uma, you should use the project API key and secret to create sessions, generate tokens, etc.
– Manik
Nov 13 '18 at 20:12
add a comment |
I am trying to integrate video call to my web application implemented using Ruby on Rails and opentok. Currently the app throws an error for "Create Session"
Failed to connect to OpenTok. Response code: Authentication failed while creating a session. API Key: 3548532
class RoomsController < ApplicationController
before_filter :config_opentok,:except => [:index]
require "opentok"
def index
@rooms = Room.where(:public => true).order("created_at DESC")
@new_room = Room.new
end
def create
api_key = "3548532" # Replace with your OpenTok API key.
api_secret = "my secret key" # Replace with your OpenTok API secret.
opentok = OpenTok::OpenTok.new api_key, api_secret
session = opentok.create_session :media_mode => :routed
session_id = session.session_id
params[:room][:sessionId] = session.session_id
@new_room = Room.new(params[:room])
respond_to do |format|
if @new_room.save
format.html { redirect_to("/party/"+@new_room.id.to_s) }
else
format.html { render :controller => ‘rooms’, :action => “index” }
end
end
end
def party
@room = Room.find(params[:id])
@tok_token = @opentok.generate_token @room.sessionId
end
end
Party.html.erb:
<div id="invitation">Invite your friends! Share the url of this page http://localhost:3030/party/<%= @room.id %></div>
<div id="videobox">
</div>
<script src="http://static.opentok.com/v0.91/js/TB.min.js" type="text/javascript"></script>
<script type="text/javascript">
var apiKey = 3548532;
var sessionId = "<%= @room.sessionId %>";
var token = "<%= @tok_token %>";
var session;
TB.setLogLevel(TB.DEBUG);
//session.connect(apiKey, token);
var session = TB.initSession(sessionId);
session.addEventListener('sessionConnected', sessionConnectedHandler);
session.addEventListener('streamCreated', streamCreatedHandler);
session.connect(apiKey, token);
var publisher;
function sessionConnectedHandler(event) {
publisher = TB.initPublisher(apiKey, 'videobox');
session.publish(publisher);
// Subscribe to streams that were in the session when we connected
subscribeToStreams(event.streams);
}
function streamCreatedHandler(event) {
// Subscribe to any new streams that are created
subscribeToStreams(event.streams);
}
function subscribeToStreams(streams) {
for (var i = 0; i < streams.length; i++) {
// Make sure we don't subscribe to ourself
if (streams[i].connection.connectionId == session.connection.connectionId) {
return;
}
// Create the div to put the subscriber element in to
var div = document.createElement('div');
div.setAttribute('id', 'stream' + streams[i].streamId);
document.body.appendChild(div);
// Subscribe to the stream
session.subscribe(streams[i], div.id);
}
}
</script>
Why is the authentication failing?
I trying to follow the instructions from https://github.com/loganathan-s/vide0-chat-using-tokbox
Thank you
ruby-on-rails opentok
I am trying to integrate video call to my web application implemented using Ruby on Rails and opentok. Currently the app throws an error for "Create Session"
Failed to connect to OpenTok. Response code: Authentication failed while creating a session. API Key: 3548532
class RoomsController < ApplicationController
before_filter :config_opentok,:except => [:index]
require "opentok"
def index
@rooms = Room.where(:public => true).order("created_at DESC")
@new_room = Room.new
end
def create
api_key = "3548532" # Replace with your OpenTok API key.
api_secret = "my secret key" # Replace with your OpenTok API secret.
opentok = OpenTok::OpenTok.new api_key, api_secret
session = opentok.create_session :media_mode => :routed
session_id = session.session_id
params[:room][:sessionId] = session.session_id
@new_room = Room.new(params[:room])
respond_to do |format|
if @new_room.save
format.html { redirect_to("/party/"+@new_room.id.to_s) }
else
format.html { render :controller => ‘rooms’, :action => “index” }
end
end
end
def party
@room = Room.find(params[:id])
@tok_token = @opentok.generate_token @room.sessionId
end
end
Party.html.erb:
<div id="invitation">Invite your friends! Share the url of this page http://localhost:3030/party/<%= @room.id %></div>
<div id="videobox">
</div>
<script src="http://static.opentok.com/v0.91/js/TB.min.js" type="text/javascript"></script>
<script type="text/javascript">
var apiKey = 3548532;
var sessionId = "<%= @room.sessionId %>";
var token = "<%= @tok_token %>";
var session;
TB.setLogLevel(TB.DEBUG);
//session.connect(apiKey, token);
var session = TB.initSession(sessionId);
session.addEventListener('sessionConnected', sessionConnectedHandler);
session.addEventListener('streamCreated', streamCreatedHandler);
session.connect(apiKey, token);
var publisher;
function sessionConnectedHandler(event) {
publisher = TB.initPublisher(apiKey, 'videobox');
session.publish(publisher);
// Subscribe to streams that were in the session when we connected
subscribeToStreams(event.streams);
}
function streamCreatedHandler(event) {
// Subscribe to any new streams that are created
subscribeToStreams(event.streams);
}
function subscribeToStreams(streams) {
for (var i = 0; i < streams.length; i++) {
// Make sure we don't subscribe to ourself
if (streams[i].connection.connectionId == session.connection.connectionId) {
return;
}
// Create the div to put the subscriber element in to
var div = document.createElement('div');
div.setAttribute('id', 'stream' + streams[i].streamId);
document.body.appendChild(div);
// Subscribe to the stream
session.subscribe(streams[i], div.id);
}
}
</script>
Why is the authentication failing?
I trying to follow the instructions from https://github.com/loganathan-s/vide0-chat-using-tokbox
Thank you
ruby-on-rails opentok
ruby-on-rails opentok
asked Nov 12 '18 at 23:55
Uma SenthilUma Senthil
921110
921110
TokBox Developer Evangelist here. It looks like you're using an older version of the API and the link you're referring to is not an official TokBox repo. I recommend checking out the following repo: github.com/opentok/OpenTok-Ruby-SDK/tree/master/sample/…
– Manik
Nov 13 '18 at 1:49
I have looked at the above link. The example is in Sinatra framework. I am not familiar with the framework and I am building on rails. Is there any documentation available for rails? Thank you so much for your help
– Uma Senthil
Nov 13 '18 at 2:54
Hi Uma, I've answered the question below with a code sample - hope it helps!
– Manik
Nov 13 '18 at 5:06
Hi Manik, Also I think my issue was that I used my account API key and Secret key. It seems that I must have created a project and generate API key and secret key for that project and used that pair(instead of the account pair) to create the session.
– Uma Senthil
Nov 13 '18 at 20:04
1
Hi Uma, you should use the project API key and secret to create sessions, generate tokens, etc.
– Manik
Nov 13 '18 at 20:12
add a comment |
TokBox Developer Evangelist here. It looks like you're using an older version of the API and the link you're referring to is not an official TokBox repo. I recommend checking out the following repo: github.com/opentok/OpenTok-Ruby-SDK/tree/master/sample/…
– Manik
Nov 13 '18 at 1:49
I have looked at the above link. The example is in Sinatra framework. I am not familiar with the framework and I am building on rails. Is there any documentation available for rails? Thank you so much for your help
– Uma Senthil
Nov 13 '18 at 2:54
Hi Uma, I've answered the question below with a code sample - hope it helps!
– Manik
Nov 13 '18 at 5:06
Hi Manik, Also I think my issue was that I used my account API key and Secret key. It seems that I must have created a project and generate API key and secret key for that project and used that pair(instead of the account pair) to create the session.
– Uma Senthil
Nov 13 '18 at 20:04
1
Hi Uma, you should use the project API key and secret to create sessions, generate tokens, etc.
– Manik
Nov 13 '18 at 20:12
TokBox Developer Evangelist here. It looks like you're using an older version of the API and the link you're referring to is not an official TokBox repo. I recommend checking out the following repo: github.com/opentok/OpenTok-Ruby-SDK/tree/master/sample/…
– Manik
Nov 13 '18 at 1:49
TokBox Developer Evangelist here. It looks like you're using an older version of the API and the link you're referring to is not an official TokBox repo. I recommend checking out the following repo: github.com/opentok/OpenTok-Ruby-SDK/tree/master/sample/…
– Manik
Nov 13 '18 at 1:49
I have looked at the above link. The example is in Sinatra framework. I am not familiar with the framework and I am building on rails. Is there any documentation available for rails? Thank you so much for your help
– Uma Senthil
Nov 13 '18 at 2:54
I have looked at the above link. The example is in Sinatra framework. I am not familiar with the framework and I am building on rails. Is there any documentation available for rails? Thank you so much for your help
– Uma Senthil
Nov 13 '18 at 2:54
Hi Uma, I've answered the question below with a code sample - hope it helps!
– Manik
Nov 13 '18 at 5:06
Hi Uma, I've answered the question below with a code sample - hope it helps!
– Manik
Nov 13 '18 at 5:06
Hi Manik, Also I think my issue was that I used my account API key and Secret key. It seems that I must have created a project and generate API key and secret key for that project and used that pair(instead of the account pair) to create the session.
– Uma Senthil
Nov 13 '18 at 20:04
Hi Manik, Also I think my issue was that I used my account API key and Secret key. It seems that I must have created a project and generate API key and secret key for that project and used that pair(instead of the account pair) to create the session.
– Uma Senthil
Nov 13 '18 at 20:04
1
1
Hi Uma, you should use the project API key and secret to create sessions, generate tokens, etc.
– Manik
Nov 13 '18 at 20:12
Hi Uma, you should use the project API key and secret to create sessions, generate tokens, etc.
– Manik
Nov 13 '18 at 20:12
add a comment |
1 Answer
1
active
oldest
votes
TokBox Developer Evangelist here.
Based on the sample application you shared, it looks like you're using a deprecated version (v0.91) of the OpenTok JS SDK.
Here's the link to the latest OpenTok JS SDK: https://static.opentok.com/v2/js/opentok.min.js
Please try the code below to create a session, connect, publish, and subscribe:
const session = OT.initSession(apiKey, sessionId);
const publisher = OT.initPublisher();
session.on({
streamCreated: event => {
session.subscribe(event.stream);
},
sessionConnected: event => {
session.publish(publisher);
},
});
session.connect(token, (err) => {
if (err) {
console.log(`There was an error connecting to the session: ${err}`);
}
});
Please note the following key changes:
- The global variable used to refer to the OpenTok object is
OT
notTB
- The
initSession
method requires both theapiKey
and thesessionId
instead of just theapiKey
. - The
connect
method only requires thetoken
instead of theapiKey
, andtoken
. - The
initPublisher
method does not require theapiKey
. - The
addEventListener
methods have been deprecated, please use.on
to set event listeners.
For more information on the web samples, please refer to the following sample project.
1
Super useful! Thanks so much for the instructions!
– Uma Senthil
Nov 13 '18 at 19:35
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53271812%2ffailed-to-connect-to-opentok-response-code-authentication-failed-while-creatin%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
TokBox Developer Evangelist here.
Based on the sample application you shared, it looks like you're using a deprecated version (v0.91) of the OpenTok JS SDK.
Here's the link to the latest OpenTok JS SDK: https://static.opentok.com/v2/js/opentok.min.js
Please try the code below to create a session, connect, publish, and subscribe:
const session = OT.initSession(apiKey, sessionId);
const publisher = OT.initPublisher();
session.on({
streamCreated: event => {
session.subscribe(event.stream);
},
sessionConnected: event => {
session.publish(publisher);
},
});
session.connect(token, (err) => {
if (err) {
console.log(`There was an error connecting to the session: ${err}`);
}
});
Please note the following key changes:
- The global variable used to refer to the OpenTok object is
OT
notTB
- The
initSession
method requires both theapiKey
and thesessionId
instead of just theapiKey
. - The
connect
method only requires thetoken
instead of theapiKey
, andtoken
. - The
initPublisher
method does not require theapiKey
. - The
addEventListener
methods have been deprecated, please use.on
to set event listeners.
For more information on the web samples, please refer to the following sample project.
1
Super useful! Thanks so much for the instructions!
– Uma Senthil
Nov 13 '18 at 19:35
add a comment |
TokBox Developer Evangelist here.
Based on the sample application you shared, it looks like you're using a deprecated version (v0.91) of the OpenTok JS SDK.
Here's the link to the latest OpenTok JS SDK: https://static.opentok.com/v2/js/opentok.min.js
Please try the code below to create a session, connect, publish, and subscribe:
const session = OT.initSession(apiKey, sessionId);
const publisher = OT.initPublisher();
session.on({
streamCreated: event => {
session.subscribe(event.stream);
},
sessionConnected: event => {
session.publish(publisher);
},
});
session.connect(token, (err) => {
if (err) {
console.log(`There was an error connecting to the session: ${err}`);
}
});
Please note the following key changes:
- The global variable used to refer to the OpenTok object is
OT
notTB
- The
initSession
method requires both theapiKey
and thesessionId
instead of just theapiKey
. - The
connect
method only requires thetoken
instead of theapiKey
, andtoken
. - The
initPublisher
method does not require theapiKey
. - The
addEventListener
methods have been deprecated, please use.on
to set event listeners.
For more information on the web samples, please refer to the following sample project.
1
Super useful! Thanks so much for the instructions!
– Uma Senthil
Nov 13 '18 at 19:35
add a comment |
TokBox Developer Evangelist here.
Based on the sample application you shared, it looks like you're using a deprecated version (v0.91) of the OpenTok JS SDK.
Here's the link to the latest OpenTok JS SDK: https://static.opentok.com/v2/js/opentok.min.js
Please try the code below to create a session, connect, publish, and subscribe:
const session = OT.initSession(apiKey, sessionId);
const publisher = OT.initPublisher();
session.on({
streamCreated: event => {
session.subscribe(event.stream);
},
sessionConnected: event => {
session.publish(publisher);
},
});
session.connect(token, (err) => {
if (err) {
console.log(`There was an error connecting to the session: ${err}`);
}
});
Please note the following key changes:
- The global variable used to refer to the OpenTok object is
OT
notTB
- The
initSession
method requires both theapiKey
and thesessionId
instead of just theapiKey
. - The
connect
method only requires thetoken
instead of theapiKey
, andtoken
. - The
initPublisher
method does not require theapiKey
. - The
addEventListener
methods have been deprecated, please use.on
to set event listeners.
For more information on the web samples, please refer to the following sample project.
TokBox Developer Evangelist here.
Based on the sample application you shared, it looks like you're using a deprecated version (v0.91) of the OpenTok JS SDK.
Here's the link to the latest OpenTok JS SDK: https://static.opentok.com/v2/js/opentok.min.js
Please try the code below to create a session, connect, publish, and subscribe:
const session = OT.initSession(apiKey, sessionId);
const publisher = OT.initPublisher();
session.on({
streamCreated: event => {
session.subscribe(event.stream);
},
sessionConnected: event => {
session.publish(publisher);
},
});
session.connect(token, (err) => {
if (err) {
console.log(`There was an error connecting to the session: ${err}`);
}
});
Please note the following key changes:
- The global variable used to refer to the OpenTok object is
OT
notTB
- The
initSession
method requires both theapiKey
and thesessionId
instead of just theapiKey
. - The
connect
method only requires thetoken
instead of theapiKey
, andtoken
. - The
initPublisher
method does not require theapiKey
. - The
addEventListener
methods have been deprecated, please use.on
to set event listeners.
For more information on the web samples, please refer to the following sample project.
edited Nov 13 '18 at 5:12
answered Nov 13 '18 at 5:05
ManikManik
682114
682114
1
Super useful! Thanks so much for the instructions!
– Uma Senthil
Nov 13 '18 at 19:35
add a comment |
1
Super useful! Thanks so much for the instructions!
– Uma Senthil
Nov 13 '18 at 19:35
1
1
Super useful! Thanks so much for the instructions!
– Uma Senthil
Nov 13 '18 at 19:35
Super useful! Thanks so much for the instructions!
– Uma Senthil
Nov 13 '18 at 19:35
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53271812%2ffailed-to-connect-to-opentok-response-code-authentication-failed-while-creatin%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
TokBox Developer Evangelist here. It looks like you're using an older version of the API and the link you're referring to is not an official TokBox repo. I recommend checking out the following repo: github.com/opentok/OpenTok-Ruby-SDK/tree/master/sample/…
– Manik
Nov 13 '18 at 1:49
I have looked at the above link. The example is in Sinatra framework. I am not familiar with the framework and I am building on rails. Is there any documentation available for rails? Thank you so much for your help
– Uma Senthil
Nov 13 '18 at 2:54
Hi Uma, I've answered the question below with a code sample - hope it helps!
– Manik
Nov 13 '18 at 5:06
Hi Manik, Also I think my issue was that I used my account API key and Secret key. It seems that I must have created a project and generate API key and secret key for that project and used that pair(instead of the account pair) to create the session.
– Uma Senthil
Nov 13 '18 at 20:04
1
Hi Uma, you should use the project API key and secret to create sessions, generate tokens, etc.
– Manik
Nov 13 '18 at 20:12