HUAWEI can't get user email info in https://oauth-api.cloud.huawei.com/ - huawei-developers

i do authorization in my app with huawei -
https://developer.huawei.com/consumer/en/doc/development/HMSCore-References/get-user-info-0000001060261938
i want to get access token, then male request to obtain user info, but can't get
emailenter image description here
enter image description here

Two things you can check:
Image 1 shows the request parameter getNickname set as 1. According to the doc: "When getNickName is set to 1, the nickname is returned." Therefore it is possible for the response only show a displayName only (not an email). The email is usually masked as a display name.Attempt to can change getNickname = 0 and try again.
If above change is not working, according to the developer documentation, "...information, such as the...email address, can be obtained only if the app has the permission to obtain the information."
You can check that your app has the permission and has been properly applied to your app and try again.
Share
Edit
Follow

Related

How to retrieve name of user in firebase

I am creating an app (Xcode, swift) that has a profile page for each user and I want their name to appear on that page.
I have been able to get their email address through:
let email : String = (Auth.auth().currentUser?.email)!
How would I gather the users name? I have the users UID as well.
I am using firebase by the way
If you are not using Google or Facebook to log in with firebase, You need to manually create the profile for each user. See Update a user's profile
If you're using a social provider to sign in, you can get the display name from that provider through Firebase with:
Auth.auth().currentUser?.displayName
If you're signing in with another provider, the display name won't automatically be set, and you will (as Abdullah answered) have to create your own registration system where the user enters their name - and you then store it in the displayName property of Firebase Authentication.
To achieve what you requested, you either have to use a social auth provider (such as Google or Facebook) or change it yourself from the client, as the other answers suggest.
First of all, you would have to create a changeRequest, using the following code
let changeRequest = Auth.auth().currentUser?.createProfileChangeRequest()
Once the change request is created, you can change whatever basic information you need to (either the photo URL or the display name) with the following code:
changeRequest?.displayName = "Lorem ipsum"
changeRequest?.photoURL = "https://your_link/path_to_image.png"
Finally, you must send the change request to Firebase, which will handle it and possibly return an error for you to handle.
changeRequest?.commitChanges { error in
if let error = error {
print(error.localizedDescription)
// You can handle the given error here
return
}
}
As others have already pointed out, you can find this and more information on the official on the official Firebase docs website.

Ionic with Backand social login: profile picture

I'm developing an application with ionic and Backand and I'm using the sign in with social accounts with the Backand service.
The social login process is OK, but I want to get the ID from Facebook and Google plus in order to get the profile picture.
I was talking with the support of Backand and I know that in Security and Auth there is an action "beforesocialSignUp" and I have not commented the line to get the data:
'use strict';
function backandCallback(userInput, dbRow, parameters, userProfile) {
// get facebook id and put in fuid field that you need to add to your user object
userInput.fuid = parameters.socialProfile.additionalValues.id;
// get gender from facebook and put in gender field that you need to add to your user object
// userInput.gender = parameters.socialProfile.additionalValues.gender;
}
And I have created the fuid field in my user object, but, when I make a login with Facebook or Google+ It doesn't save nothing. The login is OK but I can't get the ID data.
Any idea?
I had exactly the same problem.
The solution was to set the where condition of the BeforeSocialSignUp function from false to true.
This is nowhere in the documentation explained.
It took me 3 day ro figure this out :-(
Now the login works as expected and the fuid field gets assigned.
My next step is to get the profile picture from the FB Account, but therefore I have to make an API request to facebook with a user access token which I dont know how to get from backand.

Not able to retrieve gender in google plus ios sdk

I used GTLQueryPlus.queryForPeopleGetWithUserId("me") for retrieving logged in user information. I am not getting the gender in json. When I set the gender visibility to 'public' instead of 'my circles' from my google plus profile, then I got the gender.
How to get the gender info without changing the settings from googe plus profile settings?
scopes used: signIn.scopes = [kGTLAuthScopePlusMe, kGTLAuthScopePlusUserinfoProfile, kGTLAuthScopePlusLogin];
You can only access what a user has set to public. If the user doesn't want this information public then you cant have the information.
Just because I authenticate your application doesn't mean that I want you to for example to see my address or in this case my gender. So I don't set them public you cant see them.

Get user profile picture by Id

I'm now working on a web application which is mostly based of facebook graph api.
I hold some data about users - actually , the possible public data available - such as name and id.
I also know that a profile picture is a part of the public data, and I wondered how I'll be able to get a direct link to a profile picture of a user only by using their id?
http://graph.facebook.com/" + facebookId + "/picture?type=square
For instance:
http://graph.facebook.com/67563683055/picture?type=square
There are also more sizes besides "square". See the docs.
Update September 2020
As Facebook have updated their docs this method is not working anymore without a token. You need to append some kind of access_token. You can find further information and how to do it correctly in the fb docs to the graph api of user picture
Requirements Change
This endpoint supports App-Scoped User IDs (ASID), User IDs (UID), and Page-Scoped User IDs (PSID). Currently you can query ASIDs and UIDs with no requirements. However, beginning October 24, 2020, an access token will be required for all UID-based queries. If you query a UID and thus must include a token:
use a User access token for Facebook Login authenticated requests
use a Page access token for page-scoped requests
use an App access token for server-side requests
use a Client access token for mobile or web client-side requests
Quote of fb docs
You can use following urls to obtain different sizes of profile images.
Please make sure to add Facebook id to url.
Large size photo
https://graph.facebook.com/{facebookId}/picture?type=large
Medium size photo
https://graph.facebook.com/{facebookId}/picture?type=normal
Small size photo
https://graph.facebook.com/{facebookId}/picture?type=small
Square photo
https://graph.facebook.com/{facebookId}/picture?type=square
To get largest size of the image
https://graph.facebook.com/{userID}?fields=picture.width(720).height(720)
or anything else you need as size. Based on experience, type=large is not the largest result you can obtain.
From the Graph API documentation.
/OBJECT_ID/picture returns a redirect to the object's picture (in this case the users)
/OBJECT_ID/?fields=picture returns the picture's URL
Examples:
<img src="https://graph.facebook.com/4/picture"/> uses a HTTP 301 redirect to Zuck's profile picture
https://graph.facebook.com/4?fields=picture returns the URL itself
This will be helpful link:
http://graph.facebook.com/893914824028397/picture?type=large&redirect=true&width=500&height=500
You can set height and width as you needed
893914824028397 is facebookid
UPDATE September 2020
Facebook has new requirements change: an access token will be required for all UID-based queries
So you have to add your app access token to the url:
https://graph.facebook.com/{profile_id}/picture?type=large&access_token={app_access_token}
To get your app_access_token use the following url:
https://graph.facebook.com/oauth/access_token?client_id={your-app-id}&client_secret={your-app-secret}&grant_type=client_credentials
You find your-app-id and your-app-secret in the Basic Settings of your Facebook app in Facebook developers
https://www.avatars.io/
It's an API that returns the profile image when given a username for a variety of social networks including Twitter, Facebook, Instagram, and gravatar. It has libraries for iOS, Android, Ruby, Node, PHP, Python, and JavaScript.
you can get it with using this url : you will get the picture HD (max size)
https://graph.facebook.com/{userID}?fields=picture.width(720).height(720)&redirect=false
don't forget redirect=false or it will return an error
Use url as:https://graph.facebook.com/user_id/picture?type=square in src of img tag.
type may be small,large.
You can use AngularJs for this, Its two -way data binding feature will get solution with minimum effort and less code.
<div>
<input type="text" name="" ng-model="fbid"><br/>
<img src="https://graph.facebook.com/{{fbid}}/picture?type=normal">
</div>
I hope this answers your query.Note: You can use other library as well.
Through the Javascript SDK (v2.12 - April, 2017) you can get the details of the picture request this way:
FB.api("/" + uid + "/picture?redirect=0", function (response) {
console.log(response);
// prints the following:
//data: {
// height: 50
// is_silhouette: false
// url: "https://lookaside.facebook.com/platform/profilepic/?asid=…&height=50&width=50&ext=…&hash…"
// width: 50
//}
if (response && !response.error) {
// change the src attribute of img elements
[...document.getElementsByClassName('fb-user-img')].forEach(
i => i.src = response.data.url
);
// OR redirect to the URL above
location.assign(response.data.url);
}
});
For getting the JSON response the parameter redirect with 0 (zero) as value is important since the request redirects to the image by default. You may still add other parameters in the same URL. Examples:
"/" + uid + "/picture?redirect=0&width=100&height=100": a 100x100 image will be returned;
"/" + uid + "/picture?redirect=0&type=large": a 200x200 image is returned. Other possible type values include: small, normal, album, and square.
As per the current latest Facebook API version 3.2, For users you can use this generic method for getting profile picture is https://graph.facebook.com/v3.2/{user-id}/picture?type=square you can visit documentation for user picture here.
The possible values for type parameter in URL can be small, normal, album, large, square
For Groups and Pages, the profile picture is not available directly. You have to get them using access token. For Groups you have to use User Access Token and for Pages you can use both User Access Token and Page Access Token.
You can get Group's or Page's Profile Picture using the generic URL: https://graph.facebook.com/v3.2/{user-id}/picture?access_token={access-token}&type=square
I hope this is helpful for people who are looking for Page or Group Profile picture.
Simply Follow as below URL
https://graph.facebook.com/facebook_user_id/picture?type=square
type may be normal,small,medium,large. Or square (f you want to get square picture, the square size is limited to 50x50).
today I found a problem, the profile images was returning the default profile picture because a new requirement from Facebook to all the UID based queries, so just add &access_token=[apptoken] to the url, you can obtain your app token from here
You can use the following endpoint to get the image.jfif instead of jpg:
https://graph.facebook.com/v3.2/{user-id}/picture
Note that you won't be able to see the image, only download it.
Update July 2021
On top of answer by #EddyG, turned out that if you still not able to fetch the profile picture with app access token, the FB account must "allow" the FB app first then you should be able to fetch the profile picture with FB app access token.

iphone twitter and sharing

Has anyone encountered the following error message when sending to Twitter?
"Error: Incorrect signature"
And on the debug console:
<0xf14cf80 SHKTwitter.m:(356)> Twitter Send Status Error: {"request":"\/1\/statuses\/update.json","error":"Incorrect signature"}
So far as I can tell I've followed the install instructions on http://www.getsharekit.com/install/#download and it is working with Facebook, e-mail etc. just not Twitter.
It would be great if someone has seen this error before and goes "aha!".
All I did to enable twitter Sharing is:
Regitered my App as a Twitter APP (Application Type: Browser)
#define SHKTwitterConsumerKey #"My..."
#define SHKTwitterSecret #"My..."
#define SHKTwitterCallbackUrl #"http://www.anything.com/callback" // You need to set this if using OAuth, see note above (xAuth users can skip it)
\#define SHKTwitterUseXAuth 0 // To use xAuth, set to 1
\#define SHKTwitterUsername #"" // Enter your app's twitter account if you'dlike to ask the user to follow it when logging in. (Only for xAuth)
Note that for the callback function you can enter any URL you want. even www.google.com. Just make sure it is the same URL in your code.
The issue is that you're signed into your twitter account, and allowed the app to connect to your profile.
However, days go by, the Key and Secret change, and now you're seeing this error. It's because you have to log out and re-log back into Twitter. I spent waaay too much time finding this out when I created a new Twitter App to hook into (and organize my apps) and found this error.
Basically, ShareKit is saving your login info, auto-logging you in, and getting the error when twitter says the app doesn't have permission to connect to your profile.
Follow these steps to log yourself out and test again :
http://www.getsharekit.com/docs/#logout
Check this previous SO question, it might be able to help you solve the problem:
Twitter API status update always returns "Incorrect signature"