Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated CapabilityToken is not always valid #82

Closed
mabounassif opened this issue Jan 15, 2014 · 2 comments
Closed

Generated CapabilityToken is not always valid #82

mabounassif opened this issue Jan 15, 2014 · 2 comments

Comments

@mabounassif
Copy link

I have this in my controller to generate random channel name

class RandomTokensController < ApplicationController
  http_basic_authenticate_with name: ENV["APP_NAME"], password: ENV["APP_SECRET"]

  def create
    account_sid = ENV["TWILIO_SID"]
    auth_token = ENV["TWILIO_TOKEN"]

    capability = Twilio::Util::Capability.new account_sid, auth_token


      @@channel = SecureRandom.hex
      capability.allow_client_incoming @@channel

    @token = capability.generate
    @random_token = {:token => @token, :created_at => "now", :updated_at => "now"}

    respond_to do |format|
      format.json { render action: 'show', status: :created, location: @random_token }
    end
  end
end

The token I get back is not always a valid one. On average 3 out of 10 times, setting up the wait will lead to a failed attempt to listen on the connection of the random channel.

@kevinburke
Copy link
Contributor

Hey Mahmoud,
Sorry to hear this. When there's a failure, are there any more logs or stack traces that we can look at? Maybe by setting debug to true in the Javascript library, per instructions here: https://www.twilio.com/docs/client/device

@carlosdp
Copy link
Contributor

Closing due to inability to replicate. Please let us know if it happens again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants