I am attempting to follow this tutorial: https://www.youtube.com/watch?v=5lrdYBLEk60 and am getting Invalid Access Token - Code: 20101 returned when I follow everything to a tee. I changed nothing in the VideoQuickStart provided, other than adding my Twilio function link with identity: https://carnelian-chinook-9032.twil.io/video-token?identity=doug
Code for function (same as video linked):
exports.handler = function(context, event, callback) {
const AccessToken = Twilio.jwt.AccessToken;
const VideoGrant = AccessToken.VideoGrant;
const token = new AccessToken(context.ACCOUNT_SID, context.API_KEY, context.API_SECRET);
token.identity = event.identity;
const videoGrant = new VideoGrant({
room: 'TestingRoom'
});
token.addGrant(videoGrant);
callback(null, { token: token.toJwt() });
};
Beginning of ViewController.swift from VideoQuickStart example
import UIKit
import TwilioVideo
class ViewController: UIViewController {
// MARK: View Controller Members
// Configure access token manually for testing, if desired! Create one manually in the console
// at https://www.twilio.com/console/video/runtime/testing-tools
var accessToken = "TWILIO_ACCESS_TOKEN"
// Configure remote URL to fetch token from
var tokenUrl = "https://carnelian-chinook-9032.twil.io/video-token?identity=doug"
// Video SDK components
var room: TVIRoom?
var camera: TVICameraSource?
var localVideoTrack: TVILocalVideoTrack?
var localAudioTrack: TVILocalAudioTrack?
var remoteParticipant: TVIRemoteParticipant?
var remoteView: TVIVideoView?
// MARK: UI Element Outlets and handles
// `TVIVideoView` created from a storyboard
@IBOutlet weak var previewView: TVIVideoView!
@IBOutlet weak var connectButton: UIButton!
@IBOutlet weak var disconnectButton: UIButton!
@IBOutlet weak var messageLabel: UILabel!
@IBOutlet weak var roomTextField: UITextField!
@IBOutlet weak var roomLine: UIView!
@IBOutlet weak var roomLabel: UILabel!
@IBOutlet weak var micButton: UIButton!
// MARK: UIViewController
override func viewDidLoad() {
super.viewDidLoad()
self.title = "QuickStart"
....
Anyone know what I can try for this? Or if they can follow the tutorial and it works on their end? Maybe the tutorial is a bit outdated? Maybe I need to enable something on my account? Anything helps, thanks!
Repo used for example: https://github.com/twilio/video-quickstart-ios