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
- Error: User (role: guests) missing scope...
I want to send a verification code to the user and the given phone number and check it and create a session right after the user entered the secret. For me that...
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...
- custom domain with CloudFlare
Hi all, it seems that CloudFlare has blocked cross-domain CNAME link which made my app hostname which is in CloudFlare, unable to create a CNAME pointing to clo...