vonage-node-code-snippets icon indicating copy to clipboard operation
vonage-node-code-snippets copied to clipboard

Rooms SDK auth credentials 401

Open JefferyHus opened this issue 1 year ago • 0 comments

Expected Behavior

The Rooms SDK to request and return proper response.

Current Behavior

It throws unauthorized error.

Possible Solution

Allow the user to generate their own JWT token instead of using your auth library and hook it into the rooms sdk;

Steps to Reproduce

  1. Initiate the auth sdk with the proper options
    const privateKeyPath = path.join(
      process.cwd(),
      String(process.env.VONAGE_PRIVATE_KEY),
    );

    const privateKeyContent = fs.readFileSync(privateKeyPath);

    // initialize the Vonage Auth
    this.auth = new Auth({
      privateKey: privateKeyContent,
      applicationId: process.env.VONAGE_APPICATION_ID,
    });
  1. Execute the room sdk
    // initialize the Vonage Meetings
    this.meetings = new Meetings(this.auth);

    // create a room
    const room = await this.meetings.createRoom({
      displayName: roomName,
      type: roomtype,
      joinApprovalLevel: JoinType.EXPLICT_APPROVAL,
      availableFeatures: features,
    });

    return room;

Context (Environment)

I am trying to create an instant room, doing so using your own existing SDKs throws a 401 status all the time, so it does not recognize the credentials properly. I have tried to fill in all the auth properties with api keyss..etc but same issue.

To my surprise when I try to do the same thing using a custom http request with fetch or axios or just http class, it works as expected and I get a 200 with the room details.

Detailed Description

Possible Implementation

JefferyHus avatar Nov 26 '23 18:11 JefferyHus