I'm designing a voice application in Android using API.AI integrating Actions on Google (AoG) that triggers a Firebase Cloud Function.
You can see on the following image that my Android app implements a Google sign in process and also Firebase has Google user authentication.
I want to read my user information (email, name, etc.) on the Firebase Cloud Function but I couldn't do it.
I already done it using Google Home instead of an Android app.
Do you know any method to do this? I've read a lot of tutorials but no one what useful to me.
The most important part of the implementation on Android is the AIConfiguration:
final AIConfiguration config = new AIConfiguration(
CLIENT_ACCESS_TOKEN,
AIConfiguration.SupportedLanguages.English,
AIConfiguration.RecognitionEngine.System);
Where CLIENT_ACCESS_TOKEN is obtained from API.AI (like here).
Also, the API.AI console page uses Webhook with the Firebase Cloud Function that triggers correctly.
The login method is implemented using FirebaseUI.
The most important parts in this configuration are Firebase and Actions on Google:
Firebase
You need to fill two sign-in options for Google:
1) Whitelist client IDs which are automatically added if you use SHA1 fingerprint in your Android project. By the way, my app was automatically added.
2) Web SDK configuration: Fields filled with the auto generated OAuth 2.0 client ID from Google Cloud Platform's Credentials console of my project.
Actions on Google
Here I set Account Linking like in this answer.
Thanks for your help.