casdoor / casdoor-android-sdk-old

Casdoor Android client SDK
https://github.com/casdoor/casdoor
Apache License 2.0
0 stars 4 forks source link

Try build android client on java #3

Open MichaelKanzieper opened 6 months ago

MichaelKanzieper commented 6 months ago

The android sdk you suggested assumes the use of kotlin. The package specified in build.gradle: implementation 'com.github.casdoor:casdoor-android-sdk:66141e0a4b' is not suitable for android app in java. Is there any solution if I must use java for android?

Failed to resolve: com.github.casdoor:casdoor-android-sdk:66141e0a4b

casbin-bot commented 6 months ago

@tangyang9464 @JalinWang @imp2002

hsluoyz commented 6 months ago

@MichaelKanzieper https://github.com/casdoor/casdoor-android-sdk is written in Kotlin, but you can call in as a library from Java code. So I don't thing there's any issue here

MichaelKanzieper commented 6 months ago

I did a little experiment, trying to add the dependency implementation 'com.github.casdoor:casdoor-android-sdk:66141e0a4b' to the java application and I was unsuccessful. I'm sending you: 1) Errors file build.failed.txt 2) Project with the link 'com.github.casdoor:casdoor-android-sdk:66141e0a4b' added to dependencies. 3) Actually, if I understand correctly, the problem is that casdoor-android-sdk is not in the standard repositories. 4) I hope you can tell me how to solve the problem.

build failed.txt

MyApplication_25122023.zip

MichaelKanzieper commented 6 months ago

I tried to build a java app based on your previous version: https://github.com/casdoor/casdoor-android-sdk-old. I managed to do this, however, the java and kotlin versions define the configuration differently:

New version (kotlin): val casdoorConfig = CasdoorConfig( endpoint = "https://door.casdoor.com", clientID = "014ae4bd048734ca2dea", organizationName = "casbin", redirectUri = "casdoor://callback", appName = "app-casnode" )

Previous version (java): public static final String ENDPOINT = "https://door.casdoor.com"; public static final String CLIENTID = "014ae4bd048734ca2dea"; public static final String CLIENTSECRET = "ClientSecret"; // public static final String JWTSECRET = "JWTSecret"; // public static final String ORGANIZATIONNAME = "casbin"; public static final String TOKENGRANTTYPE = "authorization_code"; //*** public static final String REDIRECTURI = "casdoor://callback";

But it's not clear what needs to be substituted into three parameters: CLIENTSECRET, JWTSECRET and TOKENGRANTTYPE. Maybe you can explain?

hsluoyz commented 6 months ago

@MichaelKanzieper did you try this official example? https://github.com/casdoor/casdoor-android-example

MichaelKanzieper commented 6 months ago

This was done first. The kotlin application works great with our own endpoint & etc attributes. The problem is that our application is written in java and we must encapsulate your SDK in it.