Android using Google account but without user interaction - java

I try to develop parental control app and in setup page the parent enters his email to receive location of his kids.
when use JavaMail API using Gmail authentication, need password and email to send email to the parent (and it is not professional way to ask user email and password of his email).
And cannot be used intent because need without user interaction.
So Can anyone Help me or gives me and suggestions
I suggest send emails to user using Google account but without user interaction - If possible-

Related

Firebase Authentication email

Currently, I am working on an Android project.
I started the project with sign up and login pages using Firebase. It goes like this:
A new user enters the required details with email and password as login credentials. Meanwhile, a verification mail is sent to the provided email address, the user needs to verify the authentication by following the link in the email. If he didn't authenticate the mail, he won't be able to log in.
Now here the problem occurs! What if the user accidentally deleted the email and now he is unable to login into the app, neither he could create a new account with the same email address as firebase won't allow that.
So, what should I do in this case? Please Help!
Firebase has no requirement that the user must have verified their email address before they can sign in. While you can definitely prevent the user from using your app and accessing its data until their email address has been verified, you can still call the API to sign them in.
So even when they've lost the verification email, you can call the signInWithEmailAndPassword API to sign the user in to Firebase, and then resend their verification email.

How to send email using user's email ID from within the app (Without Intent)

Not a duplicate
I want to sent email without using any default email app so I searched a little bit and I stumbled upon this solution using JavaMail API -
Sending Email in Android using JavaMail API without using the default/built-in app
But I have few issues with this solution -
I don't want to use static username and password. Instead of that I want to use user's email ID. But it'll not be a good design if I directly ask user to enter his or her password.
So, how can I achieve this in a better way. Sorry, if this sounds too broad. Just looking for ideas not actual code.
Please, take a look at the Gmail API Android Quickstart guide. You'll be able to get the account credentials from Google Play Services and authenticate your user with OAuth2 by prompting an account selection
Instead of that I want to use user's email ID
As Gabe indicated, there is no "user's email ID" in Android. Beyond that, an "email ID" is insufficient for sending an email. You would have to ask the user both for all their email account information (username, password, SMTP server, etc.). Unless you are writing a full email client, hopefully nobody will give you this information.
how can I achieve this in a better way
Use ACTION_SEND or ACTION_SENDTO.
Or, send the email from your Web server, where your app tells the Web server what message to send via a Web service API that you implement and adequately secure. Then, you can use your own email account credentials without having to bake them into the app.

Sending email from local user account

I saw a lot of posts about this, but i am still confused.
I am using Javax mail for sending email without intent.
Is there a way to send email from local user address without asking for user credentials?
I know how to get user name of local user, but is it mandatory to use the user password?
something like Gmail Auth? can it help?
The password is required by the gmail server, and for good reason. You would not want everyone being able to use your email account to send email without you being able to stop them.
The only way you will be able to accomplish what you want is to ask the user for their email password and store it so that you can use it later in automated sending. When the user changes their gmail password you will need prompt them to update their credentials.

Sign in with Google, identification.

I have an android application - service, which sends data to the server and user is identified by email and password.
As I see I could save Google ID, name, email and etc once user is logged in, but if I use just Google ID to identify user in my service that could be unsafe. right? My service use POST method to send data to the server.
So, my question - is there any way to save Google account information and use it to identify that user on my server safely?

RESTful webservice with auth for mobile application

I have developed many stateless RESTful webservices for a mobile application in Java and they are working very well.
For example:
http://.../api/coupon
http://.../api/coupon/{id}
...
Now, I have to extend these services because I have to send different data back to the mobile for every user. So I need to know on the server side which user try to get or set information. And I have to prevent the serve of unauthorized users.
There are two different way how user can login into the mobile application:
log in with facebook account
log in with an application account
I need to develop two login and a logout services because the users who use the mobile application have to login into the application.
I read lots of article about auth and RESTful and OAuth.
I think I have to develop two login services with two imput parameters: username and password.
For example:
localLogin(String username, String password) -> token
facebookLogin(String username, String password) -> token
These logon services have to generate a same token and send it back to the mobile application in the http header. And after the login process the mobile client has a token. And the client has to send this token to the server when it makes a RESTful server call.
What do you think? Is my idea good?
If it is, could you help me how can I start to develop this in Java?
If it is not, could you tell me the good way?
You do not need 2 log in procedures. Just use the Facebook SDK!!
i) In your app would be a login with facebook button.
ii) User clicks on it and is then redirected to the facebook login page, where the user enters his credentials and facebook returns a token to you. You do not have to worry about the user's facebook credentials or storing them anywhere! Facebook will handle that for you. Consider the FB login part as black box to your app - you simply make a FB SDK's login call and it will do some processes and give back a access token to your app.
iii) Now, you can exchange the access token for the user's profile information. Enter this profile info to your database - that will ensure authenticated call.
Once you have verified that the user is logged on you can do whatever you want.

Categories