i'm trying to set up a project with facebook login and retrieve some profile infos of the users on connexion.
Context:
Spring Boot : 2.0.0.RC1
Spring Security Oauth2 Client : 5.0.2.RELEASE
Everything is working well and i'm able to connect users via facebook, my problem is that facebook is retrieving me only the id (facebook id) and the name of the user.
I would like to have much more infos from facebook on login like the profile url and the profile picture.
Security Config :
#Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
#Override
public void configure(HttpSecurity http) throws Exception {
http
.oauth2Login();
}
}
application.properties :
spring.security.oauth2.client.registration.facebook.client-id=app-id
spring.security.oauth2.client.registration.facebook.client-secret=app-secret
I even tried to add the scopes on the application.properties but nothing changed
spring.security.oauth2.client.registration.facebook.scope=public_profile,email
In the facebook documentation they are saying that
public_profile, user_friends and email are public scopes and they
dont need any verification
Any help on this?
Thanks.
Adding this property works for me:
spring.security.oauth2.client.provider.facebook.user-info-uri=https://graph.facebook.com/me?fields=id,name,email,picture
Related
This is my first time trying to access the Walmart API. I created my account and followed the onboarding steps but I can't get the Dashboard to generate "consumer ID" for me.
I have created my application, and click on “Upload/Update public key”. I copy-pasted two RSA public keys into the field; one for Staging, and one for Production. However it never creates the “Consumer ID” for my application. Can you see my dashboard entry in your system?
Why am I not issued a consumer ID after uploading my public keys?
Usually the issue will be either
the public key is invalid (or)
if you already have consumer id and trying to update with the same public key then there will be an issue (or)
if you have copied public key along with any white spaces (or)
if you are trying to upload private key by mistake
Regards,
Firdos
IO Support
I am trying to implement a social logins in flutter app and i don't want to use Firebase, I have explored on google and development forums all mostly suggests firebase for the same. Can i any one help me out of this
It will be better if one can suggest plugin/plugins for social login mainly in google, facebook, twitter and apple
Quick answer is NO.
Flutter is not strictly tied to Firebase, firebase is only one option.
There is a dart package https://pub.dev/packages/social_login, and you can use FaceBook account etc. for such purposes.
// Import package
import 'package:social_login/social_login.dart';
// Instantiate it
final socialLogin = SocialLogin();
//Before calling any methods, set the configuration
socialLogin.setConfig(SocialConfig(
facebookAppId: FACEBOOK_APP_ID,
googleWebClientId: GOOGLE_WEB_CLIENT_ID, /*In case a Google tokenId is needed*/
twitterConsumer: TWITTER_CONSUMER_KEY,
twitterSecret: TWITTER_CONSUMER_SECRET,
));
// Get current logged user
final FacebookUser facebookUser = await socialLogin.getCurrentFacebookUser();
final GoogleUser googleUser = await socialLogin.getCurrentGoogleUser();
final TwitterUser twitterUser = await socialLogin.getCurrentTwitterUser();
I'm currently building an app and I would like people to be able to sign up with their LinkedIn account.
I'm using Firebase for the back-end and LinkedIn isn't currently supported by the FirebaseAuth framework.
I know Firebase allows Custom Auth System but even after reading the doc about this, I still struggle to understand how I can plug LinkedIn there and what the so-called authentification server is.
Has someone managed to make this work?
Thanks in advance for your inputs.
Firebase Authentication supports only four federated Identity Providers out of the box: Google, Facebook, Twitter and GitHub.
For every other provider you have to use custom tokens (you will need an external Webservice).
You can read more here for a full example (the link is for Instagram but it will also work for LinkedIn as they say).
See this example in official Firebase repo: Use LinkedIn Sign In with Firebase
In this sample we use OAuth 2.0 based authentication to get LinkedIn
user information then create a Firebase Custom Token (using the
LinkedIn user ID).
Looks like the post is few years old, so not sure if you have found the solution, but for the benefit of everyone. in the current version of firebase, this is how I was able to use LinkedIn.
export function signUpWithLinkedIn() {
return auth
.setPersistence(firebase.auth.Auth.Persistence.SESSION)
.then(()=>{
const provider = new firebase.auth.OAuthProvider('linkedin.com');
provider.addScope('r_emailaddress');
provider.addScope('r_liteprofile');
auth
.signInWithPopup(provider)
.then(result=>{
console.group('LinkedIn');
console.log(result);
console.groupEnd();
return result;
})
.catch(error=>{
console.group('LinkedIn - Error');
console.log(error)
console.groupEnd();
throw error;
});
});
}
In a deprecation announcement from Google, they say that developers need to migrate away from these scopes:
https://www.googleapis.com/auth/userinfo.email
https://www.googleapis.com/auth/userinfo.profile
and instead use these scopes:
email
profile
After doing so on my App-Engine backend, however, I'm having problems with my iOS app. On first run, it asks me to sign in and the screen shows both scopes correctly after which the app runs just fine. On the second run, where it is supposed to retrieve the authorization credentials from protected storage, it does not work as the App-Engine server is receiving null for the User parameter in the endpoint.
The App-Engine endpoint requires both the email and profile scope. The iOS code for retrieving previous credentials is:
GTMOAuth2Authentication* auth =
[GTMOAuth2ViewControllerTouch authForGoogleFromKeychainForName:AUTH_KEYCHAIN_NAME
clientID:Constants.IOS_CLIENT_ID
clientSecret:Constants.IOS_CLIENT_SECRET];
and the iOS code for authenticating should there be no previous credentials is:
viewController = [[GTMOAuth2ViewControllerTouch alloc]
initWithScope:Constants.EMAIL_SCOPE
clientID:Constants.IOS_CLIENT_ID
clientSecret:Constants.IOS_CLIENT_SECRET
keychainItemName:AUTH_KEYCHAIN_NAME
delegate:self
finishedSelector:#selector(viewController:finishedWithAuth:error:)];
This used to work just fine! Now the App-Engine server changed the email scope from .../userinfo.email to email and the profile scope from .../userinfo.profile to profile. The iPad app exhibits the same behavior against the new backend with Constants.EMAIL_SCOPE set to either value.
The google-api-objectivec-client library is v0510, the latest.
The Android version of my app continues to work just fine without any code changes after the backend change.
Update 2015-02-26: Now using r424 (2014-12-30) of google-api-objectivec-client. No change. If the AppEngine backend is using the new "profile" and "email" scopes, the iOS app cannot authenticate on the second (or later) run where it is loading the credentials from store rather than going through the sign-in flow.
The AppEngine log of the first (sign-in credentials) shows:
com.google.api.server.spi.auth.GoogleIdTokenUtils getCurrentUser: getCurrentUser: IdToken; email=testuser#gmail.com
The AppEngine log of the second (loaded credentials) shows:
com.google.api.server.spi.auth.AppEngineAuthUtils getCurrentUser: getCurrentUser: AccessToken; Tried and failed to get client id for scope 'com.google.api.server.spi.config.scope.DisjunctAuthScopeExpression#a015b54e'
com.google.appengine.api.oauth.InvalidOAuthParametersException:
at com.google.appengine.api.oauth.OAuthServiceImpl.makeSyncCall(OAuthServiceImpl.java:139)
at com.google.appengine.api.oauth.OAuthServiceImpl.getGetOAuthUserResponse(OAuthServiceImpl.java:118)
at com.google.appengine.api.oauth.OAuthServiceImpl.getAuthorizedScopes(OAuthServiceImpl.java:90)
at com.google.api.server.spi.auth.AppEngineAuthUtils.getOAuth2AuthorizedScopes(AppEngineAuthUtils.java:140)
at com.google.api.server.spi.auth.AppEngineAuthUtils.getCurrentUser(AppEngineAuthUtils.java:89)
...
This exception does not propagate up; null is returned for the user.
Is there something else that needs to be done for the GTMOAuth2ViewControllerTouch to work correctly with the new scopes? Or is there perhaps something wrong on the AppEngine side?
I've created a Gmail account and linked it with Youtube.
I can sign in using the credentials on Youtube site,
but I'm getting this error when I use the data API
Exception:
com.google.gdata.util.AuthenticationException: Error authenticating (check service name)
Code:
YouTubeService service = new YouTubeService("", messages.get("youtube.devkey"));
try {
service.setUserCredentials("XXXXan#gmail.com", "alXXXX23");
} catch (AuthenticationException e) {
Can anyone explain why this is happening and/or what the service name is?
Moving my comment to a formal answer, since it seemed to have solved the problem:
There's a list of common reasons why ClientLogin might fail and suggested alternatives at http://apiblog.youtube.com/2011/03/clientlogin-fail.html