Back

JWT on non-web platforms

  • 1
  • Tools
  • Accounts
safwan
1 Jun, 2023, 07:15

Hi @Arpan Pandey

Could you explain in more detail what you're trying to do?

TL;DR
User is trying to use JWT (JSON Web Tokens) on non-web platforms with Appwrite. They want to know how to use external auth providers and if Auth0 can be used. They are also wondering if they can use GraphQL or REST methods. The user mentions that they need a JWT for client-side authentication. Solution: The user is directed to use external auth providers and is informed that web, Flutter, Apple, and Android are the only methods available for v1.1.2. They are also informed that GraphQL is not available in the cloud. REST is mentioned as an alternative and the user is asked if they are restricted
Arpan Pandey
1 Jun, 2023, 07:16

I'm trying to create a CLI so client side things

Arpan Pandey
1 Jun, 2023, 07:16

But I need a JWT to use client-side auth

Arpan Pandey
1 Jun, 2023, 07:16

I don't know how to create a JWT without opening a browser

safwan
1 Jun, 2023, 07:16

What version of Appwrite are you using?

Arpan Pandey
1 Jun, 2023, 07:16

Cloud

Arpan Pandey
1 Jun, 2023, 07:17

1.1.2

safwan
1 Jun, 2023, 07:17

Okay mind if I ask why you're using JWT? Can't you use the normal email/password auth method?

Arpan Pandey
1 Jun, 2023, 07:17

After I get a session

Arpan Pandey
1 Jun, 2023, 07:17

With email password

Arpan Pandey
1 Jun, 2023, 07:18

How do I use it to perform actions on user's behalf?

safwan
1 Jun, 2023, 07:18

Ah okay that's what you want to do. Okay let me just check this out real quick.

safwan
1 Jun, 2023, 07:19

As far as I can see in the docs, there are no docs for REST.

safwan
1 Jun, 2023, 07:19

Are you restricted to using REST, or can you use something else?

Arpan Pandey
1 Jun, 2023, 07:20

I can use GraphQL

Arpan Pandey
1 Jun, 2023, 07:20

Or anything that doesn't need a browser or native app

D5
1 Jun, 2023, 07:20

GraphQL is not available in cloud

safwan
1 Jun, 2023, 07:21

Web, Flutter, Apple and Android are the only methods available for v1.1.2

Arpan Pandey
1 Jun, 2023, 07:21

So I should use external auth?

Arpan Pandey
1 Jun, 2023, 07:21

And then maybe link it using Auth0?

safwan
1 Jun, 2023, 07:22

I didn't understand

Arpan Pandey
1 Jun, 2023, 07:24

I am saying I think I need to use an external auth provider

safwan
1 Jun, 2023, 07:32

Ah yes. The current cloud version doesn't support what you need, so it's best to go for external auth.

Arpan Pandey
1 Jun, 2023, 07:47

Ok, thanks a ton!

Drake
1 Jun, 2023, 19:34

you would have to call the create email session API manually and grab the cookie so that it can be used in the rest of the CLI tool.

See how we're extracting the cookie here: https://github.com/appwrite/sdk-for-cli/blob/b4619977eb95ca6650aa5291eb6a26d6bfa46eda/lib/client.js#L196

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