Android Native Login to Keycloak

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Android Native Login to Keycloak

Naif
!!Hello everyone!!

I was looking for some example/insight around an android native login to Keycloak, because, i would not like to use the typical browser login method(i.e using a WebView):

https://aerogear.org/docs/guides/security/img/keycloak-1.jpg

Until now, i have thought about coding a REST Web Service to receive user login, extending Keycloak API; but, i do not know the correct approach in this case.

Any help would be appreciated, thanks in advance.




Reply | Threaded
Open this post in threaded view
|

Re: [Aerogear-users] Android Native Login to Keycloak

Summers Pittman
It may be suffering from a bit of bitrot, but here is a example using Android's Authentication framework to do a native integration with KC.


On Fri, Aug 28, 2015 at 10:32 AM, Naif <[hidden email]> wrote:
!!Hello everyone!!

I was looking for some example/insight around an android native login to
Keycloak, because, i would not like to use the typical browser login
method(i.e using a WebView):

https://aerogear.org/docs/guides/security/img/keycloak-1.jpg

Until now, i have thought about coding a REST Web Service to receive user
login, extending Keycloak API; but, i do not know the correct approach in
this case.

Any help would be appreciated, thanks in advance.








--
View this message in context: http://aerogear-users.1116366.n5.nabble.com/Android-Native-Login-to-Keycloak-tp219.html
Sent from the aerogear-users mailing list archive at Nabble.com.
_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users


_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Reply | Threaded
Open this post in threaded view
|

Re: [Aerogear-users] Android Native Login to Keycloak

Naif
Thanks for the reply

I downloaded the android project, and i have followed the instructions; I imported 'demo-realm.json' and create the 'keycloak.json' file(added on res/raw), but, when i run the project, i get on my smartphone:

WE'RE SORRY ...
Invalid parameter: redirect_uri


on the server console, i get:

WARN  [org.keycloak.events] (default task-50) type=LOGIN_ERROR, realmId=98ac4271-17a4-490a-97b3-d4f11d05510b, clientId=Android, userId=null, ipAddress=192.168.0.16, error=invalid_redirect_uri, response_type=code, redirect_uri=urn:ietf:wg:oauth:2.0:oob

and in my keycloak admin console(Clients -> Android -> Settings):

Access Type: confidential
Valid Redirect URIs: http://oauth2callback
Web Origins: http://oauth2callback


Do you know, how can i solve this?
Reply | Threaded
Open this post in threaded view
|

Re: [Aerogear-users] Android Native Login to Keycloak

Summers Pittman

On Fri, Aug 28, 2015 at 7:42 PM, Naif <[hidden email]> wrote:
Thanks for the reply

I downloaded the android project, and i have followed the instructions; I
imported 'demo-realm.json' and create the 'keycloak.json' file(added on
res/raw), but, when i run the project, i get on my smartphone:

/WE'RE SORRY ...
Invalid parameter: redirect_uri/

on the server console, i get:

/WARN  [org.keycloak.events] (default task-50) type=LOGIN_ERROR,
realmId=98ac4271-17a4-490a-97b3-d4f11d05510b, clientId=Android, userId=null,
ipAddress=192.168.0.16, error=invalid_redirect_uri, response_type=code,
redirect_uri=urn:ietf:wg:oauth:2.0:oob/
^^^ Redirect uri your client is sending

and in my keycloak admin console(Clients -> Android -> Settings):

/Access Type: confidential
Valid Redirect URIs: http://oauth2callback
^^^ Redirect URI your server is expecting 

Web Origins: http://oauth2callback/

Do you know, how can i solve this?
Change one to the other.  I would suggest setting your  redirect uri in the KC console to urn:ietf:wg:oauth:2.0:oob/



--
View this message in context: http://aerogear-users.1116366.n5.nabble.com/Android-Native-Login-to-Keycloak-tp219p221.html
Sent from the aerogear-users mailing list archive at Nabble.com.
_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users


_______________________________________________
Aerogear-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/aerogear-users
Reply | Threaded
Open this post in threaded view
|

Re: [Aerogear-users] Android Native Login to Keycloak

Naif
Thanks for the suggestion.

I made the change to: urn:ietf:wg:oauth:2.0:oob, and, now it is working. Thank you very much.

I was reading the Keycloak documentation, and i found:

http://keycloak.github.io/docs/userguide/html/direct-access-grants.html

In the warning frame was written the following: "It is even highly recommended that you use the browser to log in for native mobile applications!". So, at the end, i decided to use this approach. Thank you very much for your replies.