Back

is it possible to create session using function?

  • 0
  • Users
  • Accounts
  • General
  • Functions
Vedsaga
24 Mar, 2023, 12:39

So, I am using 3rd party solution otpless to onboard user. Now, the things is this 3rd party sol does not generate session token. So, I will be using this service to simply verify user but I generate session I want to use appwrite... So, any suggestion?

TL;DR
The user is asking if it is possible to create a session using a function. They mention using an OTPless service that doesn't generate session tokens. The user also mentions integrating with Appwrite and using Google OAuth. There is a suggestion to onboard the OTPless service as a phone auth provider. The user asks for suggestions or thoughts on this. A curl command is provided for making API calls. Some links to documentation are requested for server integration with Appwrite. There is a suggestion to create a function triggered by OTPless for storing sessions. No solution is mentioned in the thread.
Vedsaga
24 Mar, 2023, 12:39
Vedsaga
24 Mar, 2023, 12:40

there response body, json { "statusCode": 200, "data": { "userMobile": "911234567890", "userName": "OTPless", "timestamp": "2023-03-24T11:28:38.148973Z" }, "user": { "waId": "test1234", "waNumber": "911234567890", "waName": "OTPless", "timestamp": "2023-03-24T11:28:38.148798Z" }, "success": true, "ok": true, "status": "SUCCESS" }

joeyouss
24 Mar, 2023, 14:26

Hi, first of all, if the userMobile is confidential - please try removing it from your sample response body for the sake of privacy, second, let me look into the best way to do this but a suggestion might be to make a function that gets triggered when OTPless indicates a login and an account is created using createAccount for storing sessions - although that might be tough given there are no tokens in response you sent

Vedsaga
24 Mar, 2023, 14:48

ahh, no not it's random phone... btw again I will mask it

joeyouss
24 Mar, 2023, 14:50

awesome! good to know

joeyouss
24 Mar, 2023, 14:55

Can you send us some link to docs about server integration so we can check how it can integrate with Appwrite

Vedsaga
24 Mar, 2023, 15:07

actually, they seems be asking for business email, but I can do one things I can copy paste the state that they asked to follow...

Vedsaga
24 Mar, 2023, 15:08

I had used bitecope support email ( steps seems fairly simple) ... they prettry much support all the frontend sdks

Vedsaga
24 Mar, 2023, 15:10

they simply asked to call, this curl url....curl curl --location --request POST 'https://companyName.authlink.me' \ --header 'clientId: test1234' \ --header 'clientSecret: test1234' \ --header 'Content-Type: application/json' \ --data-raw '{ "waId": "test1234" }'

Vedsaga
24 Mar, 2023, 15:11

they mainly only 3 response status, 101, 200 & 500 only

Vedsaga
24 Mar, 2023, 15:12

on 200 this is the body

Vedsaga
24 Mar, 2023, 18:13

any suggestion or thoughts on this would be very helpful πŸ™‚

Vedsaga
24 Mar, 2023, 18:14

but for now I have implemented the google OAuth

Drake
24 Mar, 2023, 18:54

Honestly, the best thing to do would be to onboard this as one of our phone auth providers.

We actually had a PR for adding whatsapp auth via 360dialog: https://github.com/appwrite/appwrite/pull/4536

Drake
24 Mar, 2023, 18:57

like jyoti said, you can't send headers or cookies back from functions so you can't really make a normal appwrite session...

Vedsaga
24 Mar, 2023, 18:59

mm yaa, agree... I guess no worries for now I was just wondering here and there for last couple of days figuring out which Auth to go and hwo ..have settled with Google Auth and I hope in future WhatsApp ( hopefully if possible in next release get added) and any way in meantime will try to figure out phone number provider

Vedsaga
24 Mar, 2023, 19:00

btw can like Otpless team also request for PR?

Vedsaga
24 Mar, 2023, 19:00

If so I will try to nudge them to support appwrite

Drake
24 Mar, 2023, 19:02

in order to work with us, the provider would need to have an API to send a code that we generate. My concern is otpless doesn't allow that. it seems like they generate the OTP themselves?

Vedsaga
24 Mar, 2023, 19:04

mm not sure, but as per current so flow is like there buttons user clicks they launched WhatsApp, the user clicks on send button with fixed message template and send in response get link, when user clicks on link then user get redirected back to the App... The good part that i like is link is binded with devices so if user forward the link it gets expired...

Vedsaga
24 Mar, 2023, 19:07

anyway for now I guess we can consider this thread closed... I guess I will inform Otpless team if there is any possibility they can try to integrate appwrite somehow...

Drake
24 Mar, 2023, 19:10

ya...probably not

Vedsaga
24 Mar, 2023, 19:13

it's almost ~1 AM here so will go sleep, from morning there would be quite few questions that i already have in mind to ask πŸ˜…πŸ˜‚

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