# Signature is invalid error

**URL:** <https://devforum.zoom.us/t/signature-is-invalid-error/121349>\
**Category:** Web\
**Created:** [November 22, 2024, 11:04am UTC](https://devforum.zoom.us/t/signature-is-invalid-error/121349 "2024-11-22T11:04:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dossoufico](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dossoufico/32/65156_2.png) [@dossoufico](https://devforum.zoom.us/u/dossoufico)\
**Post date:** [November 22, 2024, 11:04am UTC](https://devforum.zoom.us/t/signature-is-invalid-error/121349/1 "2024-11-22T11:04:05Z")

</div>

I am getting the invalid signature error in laravel. I am using Firebase JWT to generate the signature. Here is some of my code.

```auto
    public function generateSignature(Request $request) {

        $key = env('ZOOM_SDK_KEY');
        $secret = env('ZOOM_SDK_SECRET');
        $meeting_number = $request->meetingNumber;
        $role = $request->role;
        $iat = time();
        $exp = $iat + 3600;

        $payload = [
            'sdkKey' => $key,
            'mn' => $meeting_number,
            'role' => $role,
            'iat' => $iat,
            'exp' => $exp,
            'tokenExp' => $exp
        ];
        $encode = JWT::encode($payload, $secret, 'HS256');

        Log::info('encode',['data'=>$encode]);
        return response()->json(['signature' => $encode]);
    }

```

I cloned the demo app from github and ran it, the CDN one but got the same Invalid signature error there also.  
Note: I am using correct CLIENT\_ID and CLIENT\_SECRET by going into general app type.  
Also is it something related to publishing app or adding the app, I am new to zoom and really confused about what is going wrong. Sorry for such a big paragraph but I need help. Even a small help will really be appreciated. Also below I am providing function through which I am creating meeting.

```auto
    public function getZoomAccessToken()
    {
        $clientId = env('ZOOM_CLIENT_KEY');
        $clientSecret = env('ZOOM_CLIENT_SECRET');

        $response = Http::asForm()->post('https://zoom.us/oauth/token', [
            'grant_type' => 'account_credentials',
            'account_id' => env('ZOOM_ACCOUNT_ID'),
            'client_id' => $clientId,
            'client_secret' => $clientSecret,
        ]);

        if ($response->successful()) {
            Log::info('Access Token' . '' . $response->json()['access_token']);
            return $response->json()['access_token'];
        }

        throw new \Exception('Failed to retrieve Zoom access token');
    }

```

```auto
    public function createMeeting(Request $request)
    {
        $accessToken = $this->getZoomAccessToken();

        $startTime = now()->utc()->toIso8601String();

        $duration = 60;

        $response = Http::withHeaders([
            'Authorization' => 'Bearer ' . $accessToken,
            'Content-Type' => 'application/json',
        ])->post('https://api.zoom.us/v2/users/me/meetings', [
            'topic' => $request->topic,
            'type' => 2, // Scheduled meeting
            'start_time' => $startTime,
            'duration' => $duration,
            'settings' => [
                'join_before_host' => true,
                'mute_upon_entry' => true,
                'waiting_room' => false,
                'endMeetingOnHostLeave' => true
            ],
        ]);

        if ($response->successful()) {
            Log::info('meeting creation successful', ['data'=>$response->json()]);
            $meetingNumber = $response->json()['id'];
            Log::info('meeting creation ID', ['data'=>$meetingNumber]);
            session()->put('meetingNumber', $meetingNumber);
            return response()->json($response->json());
        }

        return response()->json(['error' => 'Failed to create meeting', 'details' => $response->json()], 400);
    }

```

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [November 28, 2024, 3:23am UTC](https://devforum.zoom.us/t/signature-is-invalid-error/121349/2 "2024-11-28T03:23:14Z")

</div>

@dossoufico do use the credentials from the development tab.  
In addition, in your embed page, make sure that Meeting SDK toggle button is enabled.

If this still does not work, give me a sample of your generated token here.

---

<div class="post-metadata">

**Author:** ![dossoufico](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/dossoufico/32/65156_2.png) [@dossoufico](https://devforum.zoom.us/u/dossoufico)\
**Post date:** [December 12, 2024, 10:32am UTC](https://devforum.zoom.us/t/signature-is-invalid-error/121349/3 "2024-12-12T10:32:49Z")

</div>

Thank you so much! And sorry for late reply! I didn’t know we have to enable the meeting SDK button, I missed that part. I will try, let you know and share a sample token if it doesn’t work. Again thank you so much!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [January 11, 2025, 8:33pm UTC](https://devforum.zoom.us/t/signature-is-invalid-error/121349/4 "2025-01-11T20:33:47Z")

</div>

Closed on January 11, 2025, 8:33pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
