Firebase Dynamic Link DMARC Error Android - android

I have been using Firebase Dynamic Links in my app for users to send email invites to other users. However, a user reported that using a Yahoo! email blocks her email invites with this error:
550 5.7.1 unauthenticated email from yahoo.com is not accepted due to domain's DMARC policy. Please contact the administrator of yahoo.com domain if this was a legitimate mail. Please visit https://support.google.com/mail/answer/2451690 to learn more about the DMARC initiative.
However when reading about the said DMARC initiative, it needs to set some DKIM keys to the domain of the sender, in which we don't have control since the user is just using Yahoo! This is the code I used to send Firebase Dynamic Links.
Intent intent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title))
.setMessage(mInviteMessage.getText())
.setDeepLink(Uri.parse("http://www.crimeresponder.com/invitation?access=" + CRLUser.Roles.getCode(mAccessDropdown.getSelectedItem().toString())
+ "&stationId=" + stationId
+ "&city=" + city))
.setCallToActionText(getString(R.string.invitation_cta))
.build();
startActivityForResult(intent, REQUEST_INVITE);

Related

React Native Read User Email Without Prompting

If I install an app on Google Play I notice that it informs me about what permissions the app requires. Once it does it in the app it also prompts me. This is all very fine.
I would like to just read the Google or Apple account e-mail - without prompting the end user for an e-mail.
I don't want to use the email as an auth token, but prefill a "Subscribe to News Letter" field. The user can then toggle ON or OFF (or choose to add another email).
If I'm getting the question right,
You need to get the primary email address of the currently signed in user, which can be used to pre-fill some kind of a form (eg. sign-up form)
For Android
Try the following react native wrapper library react-native-account-manager
Once you have setup using the instructions on the readme from the above link, use the following code to retrieve the list of signed in google accounts.
Please note this could result in an empty list, if there are no google accounts associated with the device
import AccountManager from 'react-native-account-manager';
AccountManager.getAccountsByType('accountName').then((accounts) => {
// console.log('available accounts', accounts);
let [firstAccount] = accounts;
AccountManager.getUserData(firstAccount, 'storedKey').then((storedData) => {
// console.log('stored data for storeKey', storedData);
AccountManager.setUserData(account, 'storedKey', JSON.stringify({foo: "bar"})).then(() => {
// console.log('data successfully stored');
})
});
})
For iOS
Bad luck
Apple does NOT expose the iPhone user’s details like their email address, password or credit card details to the app developer.
An alternative is to use the icloud token to create the user. You could use the following guide to do it
For a wrapper on obtaining a iCloud token using react-native use react-native-icloud-user-tokenlibrary
Kudos

android ACTION_SENDTO creates email doesn't send it

Have working code that 1) opens an email client on an android device and 2) successfully populates all the fields needed to send a message. This includes the to, from, subject and message body.
e String mailMsg = "mailto:elmer#gmail.com" +
"?cc="+"" + //needed to fill out email properly
"&subject=" + Uri.encode(subject) +
"&body=" + Uri.encode(emailBody);
Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
emailIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
emailIntent.setData(Uri.parse(mailMsg));
try{
context.startActivity(emailIntent);
}catch (ActivityNotFoundException ae){
Log.d("TEST100 ","Error sending email");
}
Again the code works fine in terms of opening the email client, creating an populating the email message but, it does not send the email. Could it be because I have multiple email providers? The code always manages to connect to and work with my mai based provider.
Have read the google documentation and most relevant posts in stackoverflow, is it possible to:
1. trigger the sending of the email message without user involvement?
2. mask the display/process of creating the email?
Any information appreciated
is it possible to: trigger the sending of the email message without user involvement?
Fortunately, no.
mask the display/process of creating the email?
Fortunately, no.
Malware authors, spammers, and the like would love to have the ability to send an email, without user involvement, using the user's own email account. Most users would find this behavior to be inappropriate.
If you want to send an email without user involvement, have your Web service send the email on your behalf, using your own email account and your own mail server.

Azure Mobile Apps - Android Authentication getting additional information

I am currently at a loss on how to proceed with my app.
I currently authenticate following the tutorial here and everything works swimmingly.Azure Mobile Apps Authentication
Where I am at a loss is how to use the id and/or token that is stored following this process to obtain basic profile information say a users email or their profile photo.
From what I have read online this is merely a azureId that stored not the google profile ID which I would use with the google+apis.
Has anyone got a reference that shows a novice programmer how to get the email address or userId required to use the google api.
The only reference I can find is a blog post from 2014. Surely there must be an easier way. And one specifically written to work on Mobile apps as opposed to mobile services. Blog post describing how to expand on authentication with google on mobile services which is no use
Here is my process
// We first try to load a token cache if one exists.
Log.v(TAG, "Click"+USERIDPREF );
if (loadUserTokenCache(mClient))
{
Log.v(TAG, "table" +mClient.getCurrentUser().toString());
createTable();
returnHome();
}
// If we failed to load a token cache, login and create a token cache
else
{
// Login using the Google provider.
final ListenableFuture<MobileServiceUser> mLogin = mClient.login(MobileServiceAuthenticationProvider.Google);
Futures.addCallback(mLogin, new FutureCallback<MobileServiceUser>() {
#Override
public void onFailure(Throwable exc) {
Log.v(TAG, "Login On fail " +exc.getMessage() );
}
#Override
public void onSuccess(MobileServiceUser user) {
Log.v(TAG, "On Success" );
createTable();
cacheUserToken(mClient.getCurrentUser());
Log.v(TAG, "On Success" + mClient.getCurrentUser() );
returnHome();
}
});
}
The first documentation link you posted has the answer. From https://azure.microsoft.com/en-us/documentation/articles/app-service-authentication-overview/#working-with-user-identities-in-your-application:
Code that is written in any language or framework can get the information that it needs from these headers. For ASP.NET 4.6 apps, the ClaimsPrincipal is automatically set with the appropriate values.
Your application can also obtain additional user details through an HTTP GET on the /.auth/me endpoint of your application. A valid token that's included with the request will return a JSON payload with details about the provider that's being used, the underlying provider token, and some other user information. The Mobile Apps server SDKs provide helper methods to work with this data. For more information, see How to use the Azure Mobile Apps Node.js SDK, and Work with the .NET backend server SDK for Azure Mobile Apps.
So to summarize, you have different options depending on which language you use, but the most cross-platform option is to send an authenticated request to your mobile app's /.auth/me endpoint. You'll get back a JSON object which contains a bunch of user claims (name, provider-specific ID, email, etc.).

Providing feedback with mail in android

I want to put feedback option in android app as some apps do. I presently have this code
Intent Email = new Intent(Intent.ACTION_SEND);
Email.setType("text/email");
Email.putExtra(Intent.EXTRA_EMAIL, new String[] { "feedback#gmail.com" });
Email.putExtra(Intent.EXTRA_SUBJECT, "Feedback");
Email.putExtra(Intent.EXTRA_TEXT, "Hi");
startActivity(Intent.createChooser(Email, "Sending Feedback:"));
But this code redirects to default app. As I don't want to show to address, I came to know that it is not possible with default in-built email app.
Later thought to implement using java api, so that I can hardcode my mail credentials(including username, password) and send it to the mail that I specify. So that user doesn't need to log in. Just he mentions his mail address in the given column, message. That's it. Then after clicking on send button, it should go the feedback mail id. But this is risky if some one converts my apk into source code as they would come to know my credentials that I used for this feedback. Can some one please suggest me how to implement this in a correct way so that user need not have any credentials or mail app?
Sending mail from php:
<?php
$to = "recipient#example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Email successfully sent!</p>");
} else {
echo("<p>Email delivery failed…</p>");
}
?>
An alternative way of hiding you data will be to post it to a server, i.e you may try considering posting your feedback data to some php script or a servlet, which later on forwards it to your mailbox.
There are so many free hostings out there, one I use for same purpose is www.3owl.com, I just have a PHP file there, and all the responses and feedbacks from all the websites are submitted there, which are then forwarded to my mailing address.
And, about mails going to Spam, well mailbox are intelligent these days, they can be taught what is not a spam, and what is :)
You could consider adding a separate API altogether and use their online client to view and manage the messages you receive:
Apptentive
LetThemVote
Recon Instruments

oauth2.0 for user profile info

how can i use oauth2.0 to get users google profile info on android app. I need the proper code/ example for an android app. I need the users information like :
profile photo
birthday
gender
location
Thanks
Google OAuth will require the following steps:
1.Register with Google here. after registering ,in the INSTALLED APPLICATION section you will get your REDIRECT_URI and CLIENT_ID
2.The REDIRECT_URI and CLIENT_ID obtained above now will be used in the following url.
https://accounts.google.com/o/oauth2/auth?" + "scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile"+ "&redirect_uri=" + REDIRECT_URI + "&response_type=code" +"&client_id=" + CLIENT_ID;
3.This url will take you to the Google Authentication page, here google takes over and you enter your account details. Further, it is redirected to the approval page, where the user allows your app to use their google data.
4.Now, as a response to this you get ACCESS CODE from google as a JSON or in the title of the html page. Parse the ACCESS CODE.
5.With the ACCESS CODE you will now make a POST request with the following post data to get the ACCESS TOKEN.
'code' // this is the access code
'client_id' // same as earlier
'client_secret' // you will find this on the google page where you registered
'redirect_uri' // same as earlier
'grant_type' = "authorization_code" // as is
6.You will now get the ACCESS TOKEN in a JSON as "access_token" . parse this access token.
7.Make use of the Access token to make a call on the following url
https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=your_access_token_here
8.You will get the users data as a response to this call as a JSON.
Here are additional docs that you may need:
https://developers.google.com/accounts/docs/OAuth2InstalledApp

Categories

Resources