React Native AppleId Authentication: email null with "hide my email" option - react-native

Environment:
Emulator: iPhone 14 Pro
#invertase/react-native-apple-authentication
I have following code for AppleId SignIn:
let appleAuthRequestResponse = await appleAuth.performRequest({
requestedOperation: appleAuth.Operation.LOGIN,
requestedScopes: [appleAuth.Scope.EMAIL, appleAuth.Scope.FULL_NAME],
})
console.log('Email: ', appleAuthRequestResponse.email) // getting null
Here on the last line I am getting email = null
What is wrong with the Apple Authentication?
Thank you mates in advance!

Related

Getting undefined in implementing Facebook SDK in an expo app

I'm trying to add Facebook SDK for my Android expo app to track the app installs. I've added the code below into StartupScreen.js in useEffect:
const fbEvent = await Facebook.initializeAsync({
appId: "FB_APP_ID",
appName: "FB_APP_NAME",
})
console.log('fbEvent::', fbEvent)
However, the log is showing undefined and there is no app events showing in Facebook.
How can I solve this? Thanks in advance.

Expo App with Google Login is not redirecting to app

I having a problem with my Google Sign In, I'm Currently using EXPO app I wish at all cost not to eject / opt out of Expo, the problem is that when I click on the Button to log in with Google in my App it does take me to the login page for me inside the browser, but once I put my Google credentials, it just lands inside the Google.com page.
I checked a lot of posts but still I'm unable to get it to come back to the app.
My app Code to log in is:
//import de Google en Expo
import * as Google from 'expo-google-app-auth';
import * as AppAuth from 'expo-app-auth';
export const googleLogin = () => {
console.log('***Entro en Google***');
return async dispatch => {
try {
const result = await Google.logInAsync({
androidClientId: '***my ID Censored***',
scopes: ['profile', 'email'],
behavior: 'web',
redirectUrl: `${AppAuth.OAuthRedirect}:/oauthredirect`
});
console.log('***Hizo Consulta***');
if (result.type === 'success') {
console.log(result.accessToken);
} else {
return { cancelled: true };
}
} catch (e) {
return { error: true };
}
}
};
I checked on many posts that the issue was the redirect URL and I tried setting 4 options:
${AppAuth.OAuthRedirect}:/oauthredirect
${AppAuth.OAuthRedirect}:/oauthredirect/google
'host.exp.exponent:/oauth2redirect/google'
'host.exp.exponent:/oauth2redirect/'
None of them worked, I did the last 2 of host.exp.exponent as that is the Bundle Identifier used by Expo on their documentation:
https://docs.expo.io/versions/latest/sdk/google/
Create an Android OAuth Client ID
Select "Android Application" as the Application Type. Give it a name
if you want (maybe "Android Development").
Run openssl rand -base64
32 | openssl sha1 -c in your terminal, it will output a string that
looks like A1:B2:C3 but longer. Copy the output to your clipboard.
Paste the output from the previous step into the
"Signing-certificate fingerprint" text field.
Use host.exp.exponent as the "Package name".
4.Click "Create"
You will now see a modal with the Client ID.
The client ID is used in the androidClientId option for Google.loginAsync (see code example below).
I did just that, and now it always gets stuck in the google.com page, any Ideas or recommendations?
Kind Regards
What have you added to your bundle id (e.g "Apple bundle ID")?
Take into account that there is a difference between production and development.
In development, you should use the default expo apple bundle id so you will be allowed to use the google login (and you won't get redirect_fail).
The default apple bundle id for development using expo is: host.exp.exponent
In production, you should have your own bundle id.
Please write up a follow-up message if any extra help is needed.
In app.json,
package name as to be all in small letters like com.app.cloneapp

Why sometimes iOS cannot open url sms on React Native

I have a problem that I'm trying to understand: How come I receive from time to time Sentry errors telling me that an iPhone X or XR could not open the SMS url?
I have this error: Unable to open URL: sms:&body=...
But what's even weirder is that when I look at my Sentry breadcrumb, I realise that this error seems to happen when the user didn't even do the necessary action to open the SMS application!
The sms I send contains a URL that is generated by Firebase Dynamics Links.
Here is the code to generate the url of the sms and the code that sends the sms
InviteFriends.js
export default inviteFriends = () => {
let sharingToken = store.getState().user.share_token
firebase.dynamicLinks().buildShortLink({
link: `http://mywebsite?type=invite&sharing=${sharingToken}`,
domainUriPrefix: 'https://mylink.page.link',
navigation: {...},
android: {...},
ios: {...}
})
.then((url) => {
sms('', i18n.t('account.addFriends.searchUser.hint.sms', {link: url}))
})
sms.js
const sms = (phone = '', body = '') => {
const sep = Platform.OS === 'ios' ? '&' : '?'
const url = `sms:${phone}${body ? `${sep}body=${encodeURIComponent(body)}` : ''}`
const supported = await Linking.canOpenURL(url)
if (!supported) {
return Promise.reject(new Error('Provided URL can not be handled'))
}
return Linking.openURL(url)
}
What I find weird is that it seems to me that if opening the SMS application wasn't supported, I'd be supposed to get a message saying "Provided URL can not be handled" instead. Am I wrong ?
Thanks you,
Viktor

Expo Calendar createEventAsync Not Working

I keep getting Event with id XXX-XXX-XXXX was not saved but not sure why
I have the permissions and actually had this working before but now can't get anything to show up on the calendar
const event = await Expo.Calendar.createEventAsync(Expo.Calendar.DEFAULT, {
"endDate": "2018-06-13T07:44:24.088-05:00",
"startDate": "2018-06-13T08:00:24.496-05:00",
"title": "PUSH",
})
I'm running an iOS simulator, Expo 26.0.0
Turned out I must have not allowed Calendar access before and it wasn't asking me anymore, so it wasn't working
Cleared the device and it asked me for permission and everything worked fine from there
Run this code for Calendar permission:-
_askForCalendarPermissions = async () => {
const response = await Permissions.askAsync(Permissions.CALENDAR);
const granted = response.status === "granted";
return granted; };

Send Grid API returns error on react native app

I use send grid API for sending mail from my react native app but it returns this error.
i use this link: "https://github.com/sendgrid/sendgrid-nodejs/blob/master/packages/mail/USE_CASES.md"
sendMail(){
const SENDGRID_API_KEY = "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";
const sgMail = require('#sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
to: 'test#example.com',
from: 'test#example.com',
subject: 'Sending with SendGrid is Fun',
text: 'and easy to do anywhere, even with Node.js',
html: '<strong>and easy to do anywhere, even with Node.js</strong>',
};
sgMail.send(msg);
}