Closed nish17 closed 5 years ago
It looks like the syntax is conv.user.access
: https://actions-on-google.github.io/actions-on-google-nodejs/classes/conversation.user.html#access
app.intent("actions.intent.SIGN_IN", (conv, params, signin) => {
if (signin.status !== "OK") {
conv.ask("You need to sign in before using the app.");
} else {
const payload = conv.user.profile.payload;
const access = conv.user.access;
conv.ask(
Great! Welcome here's your accessToken ${conv.user.access}, stringified:
${JSON.stringify(conv.user.access)}
);`
tried that too, still it's undefined
and btw the link u mentioned in the previous comment, on that page, there's not a single statement which says, conv.user.access
. Maybe u shared the wrong link.
Have you seen the Google Sign In sample? All you might be missing is async-await:
app.intent('Get Sign In', async (conv, params, signin) => {
if (signin.status !== 'OK') {
return conv.close(`Let's try again next time.`);
}
const color = conv.data[Fields.COLOR];
await conv.user.ref.set({[Fields.COLOR]: color});
conv.close(`I saved ${color} as your favorite color for next time.`);
});
In the response, I'm getting Undefined access token I'm trying to develop an AoG which can manage(read, edit, delete) events in the user's calendar. First of all i'm thinking of getting the user logged in, once that's done, and after getting access token, I can use google calendar API, passing the access token and required parameters I can get the required data.
But the problem is I'm unable to proceed because of undefined access token. Please help me here.