# Invalid access token using WEB vue js

**URL:** <https://devforum.zoom.us/t/invalid-access-token-using-web-vue-js/104497>\
**Category:** Meeting SDK\
**Created:** [February 25, 2024, 5:45am UTC](https://devforum.zoom.us/t/invalid-access-token-using-web-vue-js/104497 "2024-02-25T05:45:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![enricke](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/enricke/32/56278_2.png) [@enricke](https://devforum.zoom.us/u/enricke)\
**Post date:** [February 25, 2024, 5:45am UTC](https://devforum.zoom.us/t/invalid-access-token-using-web-vue-js/104497/1 "2024-02-25T05:45:51Z")

</div>

hello @vic.yang

Having issue on the MEETING SDK got an error

Error creating meeting: { code: 124, message: ‘Invalid access token.’ }

im trying to create a meeting and getting the meeting id

here is my code

```auto
app.post('/createMeeting', async (req, res) => {
    try {
        const zoomToken = generateZoomToken(); // Generate the token once
        console.log("teroro", zoomToken);
        
        const response = await axios.post('https://api.zoom.us/v2/users/me/meetings', {
            topic: 'test',
            type: 1 // 1 for instant meeting, you can customize it according to your needs
        }, {
            headers: {
                'Authorization': `Bearer ${zoomToken}`
            }
        });
        console.log("awaaa ",response.data)
        res.json(response.data);
    } catch (error) {
        console.error('Error creating meeting:', error.response ? error.response.data : error.message);
        res.status(error.response ? error.response.status : 500).json({ error: 'Failed to create meeting' });
    }
});

function generateZoomToken() {
    const iat = Math.round(new Date().getTime() / 1000) - 30;
    const exp = iat + 60 * 60 * 2

    const oHeader = { alg: 'HS256', typ: 'JWT' }

    const oPayload = {
        sdkKey: API_KEY,
        role: 1,
        iat: iat,
        exp: exp,
        appKey: API_KEY,
        tokenExp: iat + 60 * 60 * 2
    }

    const sHeader = JSON.stringify(oHeader)
    const sPayload = JSON.stringify(oPayload)
    const signature = KJUR.jws.JWS.sign('HS256', sHeader, sPayload, API_SECRET)
    return signature
   
} 

```

i am a developer of the account and not the owner

---

<div class="post-metadata">

**Author:** ![freelancer.nak](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/freelancer.nak/32/40968_2.png) [@freelancer.nak](https://devforum.zoom.us/u/freelancer.nak)\
**Post date:** [February 25, 2024, 9:19am UTC](https://devforum.zoom.us/t/invalid-access-token-using-web-vue-js/104497/2 "2024-02-25T09:19:00Z")

</div>

@enricke Hope you will be fine.

Here are the sessions regarding OAuth 👇

→ [Zoom Integration OAuth App Part 1](https://youtu.be/LY7jXL9FSqA)  
→ [Zoom Integration OAuth App Part 2](https://youtu.be/ytkNxMyZ8_E)

Here 👇 are the sessions regarding how to schedule meetings using REST API

→ [Create Zoom Meeting - (REST API)](https://youtu.be/4wPWajTEjxE)  
→ [How to Create password less Zoom Meeting -(REST API)](https://youtu.be/T6DGDgwetr8)  
→ [How to Enable Zoom Meeting Registration - (REST API)](https://youtu.be/yYu2NcMx5aA)

Here are the sessions regarding WebSDK Integrations

- [Zoom Meeting SDK Integration with VueJS](https://youtu.be/CMpe56VoTTo)
- [Zoom Meeting SDK Integration with ReactJS](https://youtu.be/4BgkLvH7T0Y)
- [Zoom Meeting SDK Integration with AngularJS](https://youtu.be/utXjISjjHOY)

---

<div class="post-metadata">

**Author:** ![enricke](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/enricke/32/56278_2.png) [@enricke](https://devforum.zoom.us/u/enricke)\
**Post date:** [February 25, 2024, 9:47am UTC](https://devforum.zoom.us/t/invalid-access-token-using-web-vue-js/104497/3 "2024-02-25T09:47:27Z")

</div>

Hey thanks for replying so this is my situation i wanted to create an app that let a host create stream and people can watch it without creating any account like public viewing

Flow would be  
Click the button “Spectate” and then show the stream and done

---

<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:** [February 26, 2024, 6:25am UTC](https://devforum.zoom.us/t/invalid-access-token-using-web-vue-js/104497/4 "2024-02-26T06:25:31Z")

</div>

@enricke ,

Could I confirm if you are using the correct keys for the token generation?

You will either need

- Meeting SDK App or
- General App

Within either of these apps, there is a pair of Client ID and Client Secret which can be used to generate the Auth token

---

<div class="post-metadata">

**Author:** ![enricke](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/enricke/32/56278_2.png) [@enricke](https://devforum.zoom.us/u/enricke)\
**Post date:** [February 26, 2024, 6:31am UTC](https://devforum.zoom.us/t/invalid-access-token-using-web-vue-js/104497/5 "2024-02-26T06:31:49Z")

</div>

i fixed this with creating a server-to-arever -auth

---

<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:** [February 26, 2024, 6:32am UTC](https://devforum.zoom.us/t/invalid-access-token-using-web-vue-js/104497/6 "2024-02-26T06:32:44Z")

</div>

@enricke alright， thanks for the update.

---

<div class="post-metadata">

**Author:** ![enricke](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/enricke/32/56278_2.png) [@enricke](https://devforum.zoom.us/u/enricke)\
**Post date:** [February 26, 2024, 6:41am UTC](https://devforum.zoom.us/t/invalid-access-token-using-web-vue-js/104497/7 "2024-02-26T06:41:47Z")

</div>

is there a way i can put this on a webview on expo?
