Skip to content

how to use pre request script properly #992

Answered by daniavander
daniavander asked this question in Q&A
Discussion options

You must be logged in to vote

i am not sure that u could help me more
my response: 401
response bodi: empty
auth: bearer: {{ACCESS_TOKEN}}

my code:

const axios = require('axios');

const tokenUrl = 'https://login.microsoftonline.com/' + bru.getEnvVar('AZURE_TENANT_ID') + '/oauth2/v2.0/token';
const clientId = bru.getEnvVar('AZURE_CLIENT_ID');
const clientSecret = bru.getEnvVar('AZURE_CLIENT_SECRET');
const scope = bru.getEnvVar('AZURE_TARGET_SCOPE');

console.log(clientId)
console.log(clientSecret)
console.log(scope)

try {
    let resp = await axios({
        method: 'POST',
        url: tokenUrl,
        headers: {
            'Content-Type': 'multipart/form-data',
        },
        data: {
            grant_type: …

Replies: 3 comments 10 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
10 replies
@Kaargo1
Comment options

@daniavander
Comment options

@Kaargo1
Comment options

@daniavander
Comment options

Answer selected by daniavander
@daniavander
Comment options

@Kaargo1
Comment options

@daniavander
Comment options

@Kaargo1
Comment options

Comment options

You must be logged in to vote
0 replies
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