How to show Floating Window for Sign with Google Plus in android -
i have implement signin facebook , google plus in android application.successfully implemented facebook below image.
but when implement sign in google plus shows google plus image link
please me implement same facebook login sign in google plus in android. user can enter whatever gmail account prefer sign in google.
i'm using socialauth library, supports many social networks, including facebook
, google+
.
note: can provide code examples how login in corresponding social networks using library (facebook, google+) later, if needed.
update:
1) client id's stored in oauth_consumer.properties
file (put in assets
folder)
#facebook graph.facebook.com.consumer_key = your_key graph.facebook.com.consumer_secret = your_secret #google plus googleapis.com.consumer_key=your_key.apps.googleusercontent.com googleapis.com.consumer_secret=your_secret
2) google+
requires redirect url. specify redirect url in google console of project , add in socialadapter
during initialization.
... socialauthadapter = new socialauthadapter(new responselistener(), null); setauthproviders(); ... private void setauthproviders() { socialauthadapter.addprovider(socialauthadapter.provider.facebook, r.drawable.facbook); socialauthadapter.addprovider(socialauthadapter.provider.googleplus, r.drawable.google); socialauthadapter.addcallback(socialauthadapter.provider.googleplus, google_plus_callback_url); //urn:ietf:wg:oauth:2.0:oob - if set url, accesstoken received social network should handled manually (web page (in webview) login response google+ contain in header or in response link accesstoken, , manually parsing links). not best way. socialauthadapter.enable(social); }
3) accesstoken in responselistener
when login flow finished:
private class responselistener implements dialoglistener { @override public void oncomplete(bundle bundle) { final string providername = bundle.getstring(socialauthadapter.provider); socialnetwork network = socialnetwork.valueof(providername); string accesstoken = socialauthadapter.getcurrentprovider().getaccessgrant().getkey(); } @override public void onerror(final socialautherror socialautherror) { } @override public void oncancel() { } @override public void onback() { } }
you can read more redirect url here, in "forming url authentication request" section.
Comments
Post a Comment