Im trying to get this going but no matter what I put in the redirect urls I keep getting the same error "URL Host must be one of: -list of web platforms added in appwrite-"
- if I put them to "appwrite-callback-[projectid]://" I get an error from the appwrite server that it doesnt conform the my set web platform
- if I put them to "null" it interprets them as empty / missing
- If I just not set them it thinks I want to set the scopes variable as the redirect url and complains
- "com.yourdomain.app://oauth2redirect", / doesnt work
- Localhost doesnt work
- etc public static void performOAuth(AppCompatActivity activity) { List<String> scopes = Arrays.asList("User.Read", "User.ReadBasic.All"); // Adjust scopes as needed account.createOAuth2Session( activity, OAuthProvider.MICROSOFT, null, null, scopes, new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); return; } Log.d("Appwrite", result.toString()); }) ); }
I think that the issue is permissions and also, have in mind that the order is important
How? It works on web; Permissions are set on the appwrite console and thus correct;
What do you mean by order? This is almost a copy paste from the docs and it doesn't work
Java on web?
No. My first code snippet is Java. My second one is a simple web app
I do the same thing on both. Web/ svelte works Android / Java doesnt
Ofc adapting it to their respective sdks as it says in the docs
Since it works in my web implementation all appwrite / Microsoft settings are good.
I think that the syntax for Java and JS is different. Anyways, If you're building an Android App, you don't need to specify any redirect URl, I think
As I said in my first msg I've tried everything, null won't work, which I think might be another bug (: the urls are in fact not optional params
Yes the syntax is different ... compare my first msg to the other one?
I've tried to ask / find a working 0auth2 Java android sample but have yet to find one
Though it could just ve the Microsoft provider
So should I post this to the github?
From what I understood, the issue only happens with the android SDK?
Yipyip
Correct
It passes the scopes wrong I'm suspecting
What scopes?
The code should look like this for android:
account.createOAuth2Session(
OAuthProvider.Amazon, // provider
);
Do you really need the scopes?
See my first msg ... it has it like that
Yes you do need scopes or you get another error;
For Java android btw, it's not quite the same as kotlin
The scopes should not be passed as an array like that; this is something appwrite is doing towards msft and I can
@Steven Do you know why does this happen?
already had a chat with Steven, seems like a bug in the scope usage indeed
Steven β Yesterday at 9:42 PM Hmm okay. Seems like maybe a bug in the SDK.
I don't think toString() here is the right approach https://github.com/appwrite/sdk-for-android/blob/85fac9dedd90eefe8407382cdd9f54b436862703/library/src/main/java/io/appwrite/services/Account.kt#L1212
Recommended threads
- Auto Updating Backend & Auth via Appwrit...
<@870607367597850624> Hey everyone π I wanted to ask to ask for a friend, heβs asking if Appwrite be used in a similar way to Supabase when integrated with AI ...
- User Labels use Operator.arrayInsert(βla...
Can I use the new db operators on user labels or roles?
- appwrite auth problem regarding the sess...
Hi, I have problem with auth. When I try to login/signup using OTP, at the end session.secret is empty, i have searched online and in the docs but i cannot find...