[keycloak-user] Native android facebook auth and Keycloak token

Summers Pittman supittma at redhat.com
Sun Feb 19 12:53:01 EST 2017


On Fri, Feb 17, 2017 at 11:13 AM, Julien Boulay <jboulay at ekito.fr> wrote:

> Hi all,
>
> I have a question regarding authentication with facebook and keycloak in a
> native Android app.
>
> Is it possible to connect to facebook through native application, retrieve
> an authorization code, and then exchange this authorization_code for an
> access token with keycloak (id_token, refresh_token, token) ?
>
> Can I use the facebook broker (for example
> <keycloak_server_url>/auth/realms/<myrealm>/broker/facebook/endpoint) for
> that ?
>
> Yes it is!

The code is a bit bitrotted I'm afraid, but the general example can be
found here :
https://github.com/secondsun/keycloak-android-authenticator/tree/master/app/src/main/java/org/keycloak/keycloakaccountprovider


Basically this code integrates with Android's Account provider to have deep
integration with the Android OS.  If you want  a simpler example we have
one in the AeroGear Android cookbook here :
https://github.com/aerogear/aerogear-android-cookbook/blob/master/ShootAndShare/app/src/main/java/org/jboss/aerogear/android/cookbook/shootandshare/util/KeycloakHelper.java

It uses the Aerogear Android Authz library, but it is basically a standard
OAuth flow.



>  I'm using 2.5.1-final version of keycloak server.
>
> Thanks
>
> *Julien Boulay* *- Ekito*
> Developer & Eclectic
> 15 rue Gabriel Péri 31000 Toulouse
> +33 (0)6 80 46 73 78 <+33%206%2080%2046%2073%2078>
> jboulay at ekito.fr
> *Visit our Blog <http://www.ekito.fr/people> !*
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user


More information about the keycloak-user mailing list