dunson062786 / login-programmatically-into-auth0-with-cypress

15 stars 2 forks source link

get token silently #1

Closed ed-sparkes closed 4 years ago

ed-sparkes commented 4 years ago

Hi,

Thanks for this, has been super helpful. I have it working but one thing I am unsure what to dot. My application communicates with API using bearer token getTokenSilently on the auth0client is however returning undefined when its called from the cypress test. Any thoughts welcome

Presume this is what this bit of code is for.

  cy.route({
              url: 'oauth/token',
              method: 'POST',
              response: {
                  accesss_token: access_token,
                  id_token: id_token,
                  scope: "openid profile email",
                  expires_in: expires_in,
                  token_type: 'Bearer'
              }
          });

I can see the token endpoint being called and this being intercepted and returned but for some reason

const bearerToken = await getTokenSilently()

is returning undefined

ed-sparkes commented 4 years ago

ach typo accesss_token should be access_token