Back

The time limit for a JWT token is 15 minutes.

  • 0
  • Web
  • Tools
  • Accounts
  • Self Hosted
  • Users
Marcelo Delta
16 Nov, 2023, 02:39

Do the fetch using the rest api and pass it to vuejs?

TL;DR
The user is discussing the absence of the `addHeader()` function in the node-appwrite library. They suggest using `client.setHeader()` instead to set the header. They also mention that they plan on improving this in the future. The user asks for the endpoint to create a session through the REST API, and it is suggested to create a sign-in API in Adonis that makes an API call to Appwrite using the REST API and pass it to Vue.js. Solution: The user can set the header using `client.setHeader()` instead of `addHeader()`. They can also create a sign-in API in Adonis that makes an API
Drake
16 Nov, 2023, 02:42

create some sort of sign in API in adonis that accepts the email and password. On the adonis side, use fetch to make an API call to Appwrite

Marcelo Delta
16 Nov, 2023, 02:42

I didn't find the endpoint to create a session through the rest api.

Marcelo Delta
16 Nov, 2023, 02:43

createEmailSession does not exist in the rest api

Drake
16 Nov, 2023, 02:43

you can switch Platform to REST for all of our API docs

Drake
16 Nov, 2023, 02:44

i just linked you to it

Marcelo Delta
16 Nov, 2023, 02:45

Perfect. Then, after logging in, move the session to vue so that all other requests can be met.

Marcelo Delta
16 Nov, 2023, 02:48

I will try. Thank you very much for your attention.

Drake
16 Nov, 2023, 02:49

btw we plan on improving this in the near future so you can do this with the SDK

Marcelo Delta
16 Nov, 2023, 03:38

We made a request via rest api, but no token is shown in the response.

Marcelo Delta
16 Nov, 2023, 03:39

{ "$id": "65558e577fgfgdee0281", "$createdAt": "2023-11-16T03:36:55.503+00:00", "userId": "65558d21ddfgdg50b137a", "expire": "2024-11-15T03:36:55.497+00:00", "provider": "email", "providerUid": "test@gmail.com", "providerAccessToken": "", "providerAccessTokenExpiry": "", "providerRefreshToken": "", "ip": "154.387.155.141", "osCode": "", "osName": "", "osVersion": "", "clientType": "library", "clientCode": "", "clientName": "Insomnia REST Client", "clientVersion": "2023.5", "clientEngine": "", "clientEngineVersion": "", "deviceName": "", "deviceBrand": "", "deviceModel": "", "countryCode": "br", "countryName": "Brazil", "current": true }

Drake
16 Nov, 2023, 03:50

Correct...the session is a cookie so it's in the header

Marcelo Delta
16 Nov, 2023, 03:56

thank you

Marcelo Delta
16 Nov, 2023, 04:18

We will have to change all sdk requests to rest api. In our scenario.

Drake
16 Nov, 2023, 04:28

Not necessarily. I think you should be able to set the header using client.setHeader()

Marcelo Delta
16 Nov, 2023, 04:41

in sdk node there is no client.setHeader()

Marcelo Delta
16 Nov, 2023, 04:41
Marcelo Delta
16 Nov, 2023, 19:59

Hello Steven, we are unable to use addHeader()

Marcelo Delta
16 Nov, 2023, 19:59
Drake
16 Nov, 2023, 20:40

Looks like it's missing from the types declaration, but it should still exist on the object

Marcelo Delta
16 Nov, 2023, 20:42

yes. it's missing from the types declaration

Marcelo Delta
16 Nov, 2023, 22:45

it's work import Client from 'node-appwrite/lib/client.js'

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more