Token expires for every 24hours in Google action Auth0 account linking

Hi @dan.woda

Sorry for the confusion, but for me the subject is very new and I’m very confused, I honestly don’t know what I need, but let’s go on, the story is long:

I developed the application based on this tutorial:

After everything was working, I found out that I have to change the fake token. That was when I first heard about OAuth2 and saw on Auth0 platform a simple solution without having to go into it.

I managed to adapt the routine to TypeScript and everything worked fine with Auth0:

When I found out that Google Assistant was unable to find my application after 24 hours and Google support said that this “probably” was an expired token problem.

Let’s go to application:

There is a project in Google Actions where I enter OAuth data:

In Google Assistant I find my application, login and everything works 100% for 24 hours.


But after 24 hours …

When I login my application receives the request and authenticates:

index.ts

import * as Auth from './auth-provider'
...
const expressApp = express ()
expressApp.use (cors ())
expressApp.use (morgan ('dev'))
expressApp.use (bodyParser.json ())
expressApp.use (bodyParser.urlencoded ({extended: true}))
expressApp.set ('trust proxy', 1)

Auth.registerAuthEndpoints (expressApp)
...

auth-provider.ts

...
export async function registerAuthEndpoints (expressApp: express.Express) {
  console.log ('>>>> auth-provider: registerAuthEndpoints')

  expressApp.get ('https://legooluskitsmart.auth0.com/authorize', async (req, res) => {
    const responseurl = util.format ('% s? code =% s & state =% s',
      decodeURIComponent (req.query.redirect_uri), 'xxxxxx',
      req.query.state)
    return res.redirect (responseurl)
  })

  expressApp.all ('https://legooluskitsmart.auth0.com/oauth/token', async (req, res) => {
    const grantType = req.query.grant_type
      ? req.query.grant_type: req.body.grant_type
    console.log (`Grant type $ {grantType}`)
  })