appwrite / sdk-for-android

[READ-ONLY] Official Appwrite Android SDK 💚 🤖
https://appwrite.io
BSD 3-Clause "New" or "Revised" License
98 stars 21 forks source link

🐛 Bug Report: Missing "project=<projectid>" in createOAuth2Session()'s URL in android SDK #29

Closed divyansh-kumar closed 1 year ago

divyansh-kumar commented 1 year ago

👟 Reproduction steps

when using

val client = Client(this)
           .setEndpoint("https://192.168.101.5/v1")
           .setProject("projectid")
            val con = this
GlobalScope.launch {
     val account = Account(client)
     val session = account.createOAuth2Session(con, "google")
}

its giving 412 error in browser image0

and the url was "http://192.168.101.5/v1/account/sessions/oauth2/google?" and it was missing project=projectid should be like "http://192.168.101.5/v1/account/sessions/oauth2/google?project=projectid"

but after manually adding it is giving this error image0-2

so instead of ip i used the domain which is connected to cloudflare and not appwrite i just used cloudflare tunneling to host my server so i am using my domain name with cloudflare and not appwrite however replacing ip with domain name gives me this error image0-3

i have double checked project id app id and app secret in appwrite server and cloud.google.com too. And by the way i am using kotlin SDK with version 1.2.0

👍 Expected behavior

it should be redirected and have my credentials to create a new user

👎 Actual Behavior

missing url data problem with redirecting to google cloud api

🎲 Appwrite version

Version 1.2.x

💻 Operating system

Linux

🧱 Your Environment

No environment customization just using cloudflare to connect my server with domain using tunnel

👀 Have you spent some time to check if this issue has been raised before?

🏢 Have you read the Code of Conduct?

stnguyen90 commented 1 year ago

@divyansh-kumar thanks for creating this issue! 🙏🏼

@abnegate, are we missing the project ID here?

https://github.com/appwrite/sdk-for-android/blob/32e2c6e2e12a0202757ad63adb75e8d3054443e7/library/src/main/java/io/appwrite/services/Account.kt#L803-L807

abnegate commented 1 year ago

@stnguyen90 Yep looks like it, will fix 👍