i am trying to implement google auth in andorid but it just keep giving me general_bad_request
// Android Manifest
TypeScript
<activity
android:name="io.appwrite.views.CallbackActivity"
android:exported="true">
<intent-filter android:label="android_web_auth" android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="appwrite-callback-myprojectcode" />
</intent-filter>
</activity>
// Conpanion Object
TypeScript
object Config {
// Change below values to match your Appwrite project
const val HOST = "cloud.appwrite.io"
const val PROJECT = "--my--project--code"
const val TAG = "TrashActivity"
// DO NOT mutate below values
const val ENDPOINT = "https://$HOST/v1"
const val CALLBACK = "appwrite-callback-$PROJECT"
}
// Implementation
TypeScript
val client = Client(applicationContext)
.setEndpoint(Config.ENDPOINT)
.setProject(Config.PROJECT)
.setSelfSigned(true)
val account = Account(client)
binding.loginBtn.setOnClickListener {
GlobalScope.launch {
try {
account.createOAuth2Session(
activity = this@TrashActivity,
provider = OAuthProvider.GOOGLE,
success = "${Config.CALLBACK}://${Config.HOST}/auth/oauth2/success",
failure = "${Config.CALLBACK}://${Config.HOST}/auth/oauth2/failure"
)
} catch (e: Exception) {
Log.d(TAG, "Exception: $e")
}
}
}
TL;DR
Developers are facing 'general_bad_request' issue while implementing Google auth in Android. The issue might be related to the configuration in the AndroidManifest file or the specified endpoints in the companion object.
To solve the issue, developers should ensure the correct configurations in the AndroidManifest and companion object, especially the callback URLs and project codes. Double-check the URLs in the success and failure parameters. Also, verify if the OAuth provider is correctly set to GOOGLE.
Double-check all configurations and ensure they match the Appwrite project details.Recommended threads
- Updating GitHub App access throws error
Steps to reproduce - 1. Have some private repos allowed on the install access 2. New Site/Func > Connect GitHub > see the side card saying `Missing a repo` > cl...
- Bug report: Race condition in Flutter SD...
Hi team, I've found an intermittent bug in the Flutter SDK (v20.3.0) when using `createOAuth2Session` on Android. **Symptoms** After `createOAuth2Session` re...
- New Build not visible on Domain
I pushed some new code to my Appwrite Site and the build succeeded and is shown as active. Yet, I can only see the new version of the site on Appwrite's provide...