iOS facebook login response does not contain profile data - ios

I implemented Facebook login for both Android and iOS using react-native-facebook-login. I followed all of the instructions and it is working perfectly on Android. It works on iOS, but the response does not contain profile data.
Android Response:
declinedPermissions: [],
provider: 'facebook',
profile:{
id: '121212121212121212',
name: 'XYZ',
email: 'xyz#gmail.com',
first_name: 'XYZ',
last_name: 'XYZ',
age_range: { min: 21 },
link: 'https://www.facebook.com/app_scoped_user_id/121212121212121212/',
picture: { data: { is_silhouette: false,url: 'https://scontent.xx.fbcdn.net/v/t1.0-1/12/12.jpg?oh=12&oe=12' } },
gender: 'male',
locale: 'en_US',
timezone: 5.5,
updated_time: '2017-02-01T08:16:35+0000',verified: true },
type: 'success',
credentials: {
permissions: [ 'public_profile', 'contact_email', 'user_friends', 'email' ],
tokenExpirationDate: '2017-05-13T14:56:36.690+0530',
userId: '1212121212121212121',
token:'ababababababababbababababa' }
But on iOS, the response is incomplete and there is no profile data:
declinedPermissions: [],
credentials: { tokenExpirationDate: '2017-05-14T14:58:09+05:30',
permissions: [ 'email', 'contact_email', 'user_friends', 'public_profile' ],
userId:'12121212121212121',
token:'abababababababababababababa' },
missingPermissions: []
The code is same for both Android and iOS. And I did all of the configuration changes in Xcode. Is there something else that needs to be done to get the profile data on iOS?

We need to do another API call where we send the token which was generated into this API call.
fetch('https://graph.facebook.com/v2.5/me?fields=email,name,first_name,last_name,friends&access_token=' + YOUR_GENERATED_TOKEN)
.then((response) => response.json())
.then((json) => {
})
.catch(() => {
reject('ERROR')
})
This call will give you the profile details.

Related

Change request payload in Nuxt Auth

I have this Facebook strategy:
facebook: {
access_token_endpoint: 'http://***.**/api/v0/auth/social',
access_type: 'offline',
client_id: '*******',
grant_type: 'authorization_code',
redirect_uri: socialLoginUrl + '/account/aanmelden',
response_type: 'code',
token_key: 'jwt',
userinfo_endpoint: 'https://****.***.**/user/profile'
},
When I try to register with Facebook I get the following form in the request:
code: **
client_id: **
redirect_uri: **
response_type: **
grant_type: **
I want to supply some data to the back-end when I register:
"attributes":{
"code":"*****",
"vendor":"Facebook"
},
How do I add this to the form that's being sent to the access_token_endpoint ?
// updated question.
Calling the loginWith function:
#click="$auth.loginWith('facebook', { params: data })"
data object:
data () {
return {
data: {
type: 'user',
attributes: {
vendor: 'Facebook',
code: '**'
}
},
}
},
Request payload in the browser:
code=**&client_id=**&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Faccount%2Faanmelden&response_type=code&grant_type=authorization_code
Response from the back-end:
I expect the data object to be available in the payload, but I'm not sure if I'm doing this correctly.
From the official docs, it looks like you can do
this.$auth.loginWith('facebook', { params: { /* additional authentication parameters */ } })
.then(() => this.$toast.success('Logged In!'))
I never used it with Facebook but it's working great with local (using JWT).
The related part of the documentation: https://auth.nuxtjs.org/api/auth#loginwithstrategyname-args

Creative and Objective Mismatch while creating Carousal Ad by using Marketing API

I'm creating Carousel Ad via marketing API. During the Ad creation Facebook through "Creative and Objective Mis-match" error. However, Campaign and Adset are successfully creating.
I have changed the objective as per Facebook documentation. I tried multiple combinations but got errors. e.g: "Billing event invalid for optimisation goal, Creative and Objective Mismatch, Invalid Creative for Objective"
Doc_link
res = ad_account.ads.create({
status: 'ACTIVE',
name: ' SDK',
adset_id: adset.id,
creative: {
object_story_spec: {
page_id: fb_page_id,
link_data: {
child_attachments: [
{
description: "$8.99",
image_hash: "1ea34798e1ba00ffaab318dc",
link: "www.facebook.com",
name: "Product 1",
video_id: "42920500794",
call_to_action: {
type: "LEARN_MORE",
value: {
link: "www.facebook.com"
}
}
},
{
description: "$9.99",
image_hash: "8299deb1e053f7601c4f99f44",
link: "www.facebook.com",
name: "Product 2",
video_id: "378442876",
call_to_action: {
type: "LEARN_MORE",
value: {
link: "www.facebook.com"
}
}
},
],
:link => "www.facebook.com",
},
}
}
})
I need to create a complete carousel ad by using marketing API.

Slack user id is not recognized with error: 'user_not_found'

I am doing a fetch to the slack.com/api/users.info method using:
return await fetch('https://slack.com/api/users.info?token=' + process.env.SLACK_AUTH_TOKEN + '&user=' + slackUserId + '&pretty=1', { method: 'POST' })
The slack user id is correct and shows the same as I can see when clicking my profile in the Slack app, yet the Slack API can not find my user, as I get error: { ok: false, error: 'user_not_found' }.
This is the first time I have this problem, it worked before, but I did not do any changes in the code.
{ token: 'xxx',
team_id: 'xxx',
api_app_id: 'xxx',
event:
{ client_msg_id: 'xxx',
type: 'message',
text: 'test',
user: 'UE8DHTXXX', // User id here
ts: 'xxx',
channel: 'DK037CXXX',
event_ts: 'xxx',
channel_type: 'im' },
type: 'event_callback',
event_id: 'xxxxxxxxx',
event_time: 1559808987,
authed_users: [ 'xxxxxxx' ] }
Error: { ok: false, error: 'user_not_found' }

Internal server error when saving card in paypal vault

I am using pay-pal vault to store my users credit card. When am trying to store user credit card am getting internal server error with response code = 500. I have tried with different type of sample test cards, but still it is not working for me. Please save me from this issue.
credit_card = {
number: "5183330730754255",
type: "mastercard",
expire_month: 11,
expire_year: 2018,
cvv2: "874",
first_name: "Joe",
last_name: "Shopper",
billing_address: {
line1: "52 N Main St.",
city: "Johnstown",
country_code: "US",
postal_code: "43210",
state: "OH",
phone: "408-334-8890"
},
external_customer_id: "nodedeveloper122"
}
result = Typhoeus.post(
'https://api.sandbox.paypal.com/v1/vault/credit-cards/',
:params => credit_card,
:headers => {"Content-Type" => "application/json", "Authorization" => "Bearer ************"}
)

OAuth 2.0 Scope for Google Apps users' names with google-api-nodejs-client

I'm trying to use Google's 'google-api-nodejs-client' package (https://github.com/google/google-api-nodejs-client) to handle OAuth 2.0 authentication.
I've modified the example in examples/oauth2.js to console.log the entire profile object.
What scope can I use to correctly extract users' 'givenName' and 'familyName' if they're authenticating using a Google Apps account? Using the following scope:
scope: [
'https://www.googleapis.com/auth/plus.login',
'https://www.googleapis.com/auth/plus.profile.emails.read'
]
returns the following response once authenticated:
{ kind: 'plus#person',
etag: '"LONG STRING"',
emails: [ { value: 'example#example.example', type: 'account' } ],
objectType: 'person',
id: '123456',
displayName: '',
name: { familyName: '', givenName: '' },
image:
{ url: 'https://lh3.googleusercontent.com/ etc etc',
isDefault: false },
isPlusUser: false,
language: 'en_GB',
circledByCount: 0,
verified: false,
domain: 'example.example' }
I tried fooling around with the API on the API Explorer (https://developers.google.com/apis-explorer/#p/plus/v1/plus.people.get?userId=me) and only needed the 'https://www.googleapis.com/auth/plus.login' scope to get my familyName and givenName.
Perhaps the user that you are requesting the data from does not have a given and family name set?

Resources