How do I automate Phone verification (need codes sent to mobile)? - android

[Background]
I am looking for some way to automate phone verification (6 digit code sent on cell phones(android) )
[My Way-probably really lame]
Create an app that polls messages coming in, search for keyword "verification".
If found ,get the 6 digit number from the message and update the file over network from cell.
Script on PC will read entry of file after the verification code was sent and use it.
Are there any API's exposed?
Verification is similar to what we have on gmail.
Thanks in advance for any inputs

Sync Messages to another Gmail acocunt where such login is not required.
Create an Console app that reads you gmail folders
poll for latest message, and voila, you have your code.

Related

Is there any problem with firebase authentication?

Is there any problem with Firebase authentication?
I am not receiving any email (verification or reset) from yesterday.
I can't even send reset email from console manually
I have checked spam folder also.
Here is my code
FirebaseAuth.getInstance().sendPasswordResetEmail(email)
.addOnSuccessListener(unused -> {
//is called
})
.addOnFailureListener(e -> {
});
Above code worked before, but recently I am facing this issue. I have tried to send reset password to an email through firebase authentication manually, but it's not working even.
More info:
If I add user manually and send email, it shows email sent successfully. But I don't receive any mail.
If the API call succeeds, the email was sent successfully. If it doesn't show up where you expect it, it got lost along the way - typically in a spam filter or a spam folder.
Spam filters are common on large company infrastructure. To check whether the message got caught in such a spam filter, you'll have to check with any IT team that owns part of the delivery infrastructure along the way.
An easier way to check might be to send to a public mail provider, such as Gmail. If the message shows up in the spam folder there, you know your code is working correctly. To prevent it getting caught as spam, have a look at my answer here: Why did this code fail to send password reset link in firebase?

Reading SMS using Appium on Android

I am trying to automated a flow where I can read sms and then parse the SMS to read the OTP and enter it in another webapp. Looked through all forums but couldn't find an answer.
I am writing code in java and trying to run a webapp on android device using appium.
Can someone suggest how to do it?
If you want to read sms from device in Appium session there is a good approach described in discuss.appium.io
I think you can create several sessions in one test: 1 - to get sms with native app, 2 - open webApp in mobile browser and do whatever you need
This approach worked for me
Suppose your OTP sms is like "OTP is 12345 for your order", and it shows up in your notification panel,
Reach the OTP Screen
Pull down the notification bar ((AndroidDriver) driver).openNotifications();
Wait for this element otpElement with xpath //android.widget.TextView[contains(#text,'OTP is')] is displayed (ie, While the sms arrives)
Use OTPmessage = otpElement.getText() to get the OTP message text
Extract OTP using this code : String OTP = StringUtils.substringBetween(OTPmessage, "OTP is ", " for ");
Close notification panel using ((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.BACK));
I dont think this is a good approach if you are testing the app. It might take lot of time for the OTP to arrive thereby failing your test unnecessarily. Better ask your devs keep the OTP fixed so you don't need to receive it through the sms everytime.
You can add a key to store last OTP in an in-memory storage like Redis or closured Dictionary in your backend language, you will then update this key with the value of the OTP you want to send out via an SMS service provider. The last sent OTP stored in this key should then be exposed via an additional api endpoint in your service, which you would then call as part of your automated script after doing an action that will make the OTP to be sent.
A more reliable and robust modification of this will be to expose an API that retrieves the OTP stored against each phone number, you must have this stored already of course before you could do the verification in-app. This endpoint must only be exposed within a test environment, that's the precaution to pay attention to, or you make the endpoint available only to authorized user roles.

WSO2Emm - Authentication failed during registeration

I create a user as entroduced in doc, but in authentication phase it failed.
I try to register using following ways, as no invitation email sent to the user!
using pass appear in QR code and the the username which I entered
change pass in carbon console for the user - try this pass with the username
try sending an invitation email - but no email has been sent
Error :
Authentication Failed: Cannot proceed the authentication. Please contact administrator.
PS: I working in a developer environment, I have installed server as a windows service , and android agent to my galaxy not.
Vendor Name field of the EMM-DB's DEVICES Table is declared too short, they declared it as Varchar(11) so even if the agent code runs correctly, the server does not accept the return result from the agent. This might be the case.
You can check it from the servers console. Or you can try it with another Android Device. Also it would be beneficial to check the return String of the
Build.MANUFACTURER;
from the Android device.
You need to configure email in EMM settings. Otherwise it will not send an email, instead message will be popup and show you only the password and QR code (download path of the app) when you register the user.

Project not whitelisted CCS(GCM)

I'm using java server to send message to use google cloud message. But when i sent message i've received " project ** not whitelisted"
i've signed up at https://services.google.com/fb/forms/gcm/ and received a confirm email with content "Thank you. Your information has been sent to Google. A member of the team will be in touch shortly."
but when i try to send message again still received "project ** not whitelisted"
who can tell me how long does it take to whitelisted by google?
Probably you can expect mail from Google withing certain period(May be 3 months) of time.But am not sure how much time it will take.These are the links that i found on the internet which may help you:
1.Developer Console
2.Google user got mail
3.Discussion on Google group

Read latest thread mail using javamail

as we know that Conversation threading is a feature used by many email clients in which the software aids the user by visually grouping messages.
i build an email client application using javamail running on Android.Guide from this post, i have sucessfully to get unread message.
This output is nested mail like converstation
- A replay to B (latest message)
- B reply to A
- mail from A to B (first mail)
My problem is, i want to get only the latest message on this thread [A replay to B (latest message)]. How Should i do it??
You're going to have to request enough envelope/header information to figure out which message that is, then you can fetch only the content for that message.

Categories

Resources