How to print email verification URL from Firebase Auth in Emulator? - firebase-authentication

I am using the Firebase Emulator for local testing. I have a signupUser Firebase Function that uses Firebase Auth to sign up users (and does some extra work). Both of them use the Emulator, and the issue is, this way the email verification URL does not get printed neither to the console (in which I run the Emulator) nor to the Functions Log. As a result, I cannot verify my new test users and cannot log in. Is there any other way to verify these test users' email addresses or to manually print the verification URL?

Ok, I've found it. Using the Admin SDK we can generate a verification link, that we can then console log.
import * as admin from 'firebase-admin';
admin.auth().generateEmailVerificationLink(useremail, actionCodeSettings)
Docs: https://firebase.google.com/docs/auth/admin/email-action-links#generate_email_verification_link

There is another way, more automated, so you don't need to add the admin sdk:
Here is the auth log output for a new user within the Emulator:
Then base on this documentation you can fetch the oobCodes (out of band
codes) with restAPI:
Also documentation described here

Related

Auto Read OTP in flutter using firebase is possible?

I have same problem and search a lot . But can't find exact Solution.
But I solve this problem by enabling 'Android Device Verification' API
Steps:
1:Go to the Library page in the Google APIs Console.
2:Search for, and select, the Android Device Verification API. The Android Device Verification API dashboard screen appears.
3:If the API isn't already enabled, click Enable.
4:If the Create credentials button appears, click on it to generate an API key. Otherwise, click the All API credentials drop-down list, then select the API key that's associated with your project that has enabled the Android Device Verification API.
Check this link for more information
https://developer.android.com/training/safetynet/attestation?authuser=0
The following package helps for auto reading of OTP
sms_autofill
https://pub.dev/packages/sms_autofill
This is a Similar issue for android mentioned, and Below are few work around:
You need to make sure the message you receive contains the hash of your app. Below is the right format :
123456 is your verification code for %APP_NAME%.
abc_hascode_xyz
If your SMS does not contain the hashCode at the end, you might have to shorten your app name to not more than 15 characters.
If your app is already published on Google Play, the name in the SMS will be the same as the one in the Google play store.
If you changed the name to 15 characters and the error still persists, you might have to wait for at least 24hours for the change to reflect on firebase.
if after all above it's still not resolved, please check if your receiver is well configured in the code.
check out the new GooglePlay policy on app name : Examples of common app names violations
Firebase auth with the phone automatically detects OTP in the phone itself.
But in few cases, OTP is not fetched by itself so I would like to suggest you please make a template such that OTP automatically gets detected.

Email verification in Firebase Console

Is there a way for administrators to see and change the status of email verification from inside the Console? Everything I’ve found so far is based only on the client pushing a verification email from the backend and checking its status. It would be useful for the admin to get an overview of this too.
The email verification status is not shown in the Firebase console. It's not a bad idea, so I'd definitely file a feature request.
For individual users you can use the Firebase Admin SDK to read or change the emailVerified property.
To get the status of all users, you can use the auth:export command of the Firebase CLI.

Account linking Actions on Google with App Engine Standard

I have an App Engine Standard project for API.AI fulfilment webhook. Users interact with my app through chat (Google Assistant) only—no Web interface. In summary, the app is a chat backend.
My app requires user's email to send updates. I read that I need account linking.
Based on this answer in SO, this is exactly what I did:
In GCP console → APIs & services → Credentials, I created new
OAuth 2.0 client ID, with Authorized redirect URI: https://oauth-redirect.googleusercontent.com/r/[my-project-id].
In Actions on Google console → Account linking, I chose Authorization code with:
Client ID and Client secret copied from previous step
Authorization URL: https://accounts.google.com/o/oauth2/v2/auth
Token URL: https://www.googleapis.com/oauth2/v4/token
Scopes: profile and email (initially I put fully namespaced, e.g. https://www.googleapis.com/auth/userinfo.email but somehow it got "shortened")
Testing instructions: A dummy Google account I created
In API.AI console → Integrations → Google Assistant, Sign in required for welcome intent is ticked.
The whole setup kinda works. Here's how it goes in the simulator:
Typed, "Talk to [my app]"
Received response, with login URL in the debug tab
Copy pasted the URL, login successful, redirected to Google home page
Back to simulator, typed: Talk to [my app]
Connected (auth code is passed in webhook calls, and my app can query user's email)
Two issues:
Why do I need to type Talk to [my app] twice?
My submission is rejected because "Your provided testing instructions either did not work correctly or were not substantial enough. Please ensure that you are providing everything needed for us to test your app, and that all credentials you provide work correctly."
Where did I do wrong?
EDIT: I tried using Android 6, it says "It looks like your [project] account is not linked yet," and there's a button to link. Upon clicking, it shows Google Account selector, but clicking it doesn't do anything (and no request to my server).

Google Drive Android: Error signing in the specified account. Please choose a different account

I am implementing the google drive use google play services.
I enable drive Api and Drive SDK from api console, and implemented configuration settings for Drive SDK, But when I try to login from my application, I get the following error,
Error signing in the specified account. Please choose a different account,
I add another account but facing the same error,
I did not know what is the problem? did I have to add the test users? but I did not find any place to test users.
In authentication section (https://developers.google.com/drive/web/enable-sdk#drive_integration). I found . In order to authenticate Drive users with the user info service, you must manually enter the following two scopes:
email
profile
But scope section only allow to enter the url and not the email and profile.
In the Google Developers Console, the package name must be the same as the Android app's package name in your android studio.
If you enter the wrong name, you may get this error message.

How to do Google Sign-In in Meteor

I've tried various tutorials and links on how to get Google Sign-In to work in Meteor to no avail. How can I create a google sign in button on my login page that redirects to my user dashboard--using iron:router perhaps (and shows the persons name in the corner), and restrict the google emails to only .edu accounts?
Also as the admin of the page how would I be able to see the emails/names of all the people who have logged into my website? Is this done through Google Analytics?
Try adding the accounts-google package. You'll need to configure the Google sign in with the application key and secret. The easiest way to do this is to also add the accounts-ui package and using
{{> loginButtons}}
which will display detailed instructions on the steps to follow on the Google page. It will also save your app key and secret tokens appropriately.
Once this is done you'll be okay using the method
Meteor.loginWithGoogle()
as explained in the docs. It takes an optional array of options and a callback function
e.g
Meteor.loginWithGoogle({}, function(error){
if(error)
//Couldn't log in
else
Router.go('/dashboard');
})
Good luck
For Google Sign-in, I would recommend installing the accounts-entry package and configuring it from your browser:
install with latest meteor version
meteor add joshowens:accounts-entry
and for meteor version before 0.9 use
mrt add accounts-entry
For your dashboard redirection, review the documentation for that package on atmospherejs.com which demonstrates how to configure your dashboardRoute:
dashboardRoute: '/dashboard'
The iron-router package is a dependency of accounts-entry, so it will be installed as well.
Access the data by launching the MongoDB shell (after starting your app):
meteor mongo
Query for the accounts using the MongoDB shell:
db.users.find()
This is not handled via Google Analytics