Getting Access Token
const url = new URL(window.location.url)
const code = url.searchParams.get('code')const verifier = 'my secret text'
const tokenUrl = 'http://api-sandbox.edgetag.io/v1/oauth-app/client/token'
const body = new URLSearchParams({
code,
code_verifier: verifier,
grant_type: 'authorization_code',
})
const response = await fetch(tokenUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: `Basic ${btoa(clientId + ':' + clientSecret)}`,
},
body
})curl --request POST \
--url http://api-sandbox.edgetag.io/v1/oauth-app/client/token \
--header 'Authorization: Basic ZDAyNzJjNDItN2VjYy00ODk5LWExYTctMDgwMWE4YTlkYTJmOmQwMjcyYzQyLTdlY2MtNDg5OS1hMWE3LTA4MDFhOGE5ZGEyZg==' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data code=kaKTYtdQw7Qxa-aSIQjjvFNXqLiZ_TlwAoXSocuQypQ \
--data code_verifier=my%20secret%20text \
--data grant_type=authorization_codeLast updated
Was this helpful?

