Skip to content
Discussion options

You must be logged in to vote

Given your test case, you might not need to call spec multiple times. Just chain all the calls to make it simple.

Given(/^an authorised user$/, async () => {
  // Single, clean authentication request
  await spec()
    .withHeaders({
      'Content-Type': 'application/x-www-form-urlencoded',
      'Host': 'fusion.auth.--.--.--',
      'Cookie': 'fusionauth.sso=Ah0CfFInltQLGjQyIjnpjtVtGPY9rFVQs6XOyUrpApOC',
    })
    .withForm({
      'scope': 'offline_access',
      'username': process.env.API_USERNAME,
      'password': process.env.API_PASSWORD,
      'grant_type': 'password',
      'client_id': process.env.API_CLIENT_ID
    })
    .post(process.env.FUSION_AUTH_URI + '/oauth2/token')
    .

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@Nikita363
Comment options

@Nikita363
Comment options

@leelaprasadv
Comment options

@Nikita363
Comment options

@Nikita363
Comment options

Answer selected by Nikita363
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants