Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Generated CapabilityToken is not always valid #82

Closed
mabounassif opened this Issue · 2 comments

3 participants

@mabounassif

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

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
Owner

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

@carlosdp carlosdp closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.