최근 검색


최근 검색 없음

IT Support's Avatar

IT Support

가입한 날짜: 2022년 6월 10일

·

마지막 활동: 2022년 6월 14일

팔로잉

0

팔로워

0

총 활동 수

2

투표 수

0

가입 플랜

1

활동 개요

님의 최근 활동 IT Support

IT Support님이 에 댓글을 입력함

댓글Security and user access in Zendesk Support

Good evening,

In trying to setup the oauth authorization flow, I am getting a 405 on the preflight request to /oauth/tokens. I have double, triple and quadruple checked my code against the docs and examples, but with no success. Am I missing something in understanding what Zendesk expects to grant an access token? For example, am I running into errors because my origin is http://localhost:8081(i.e. not https)? Is there a way to avoid the sending a preflight with the OPTIONS method that's returning the 405?

onMounted(() => {
let authCode;
if (route.query.code) {
  authCode = route.query.code
  requestZendeskAccessToken(authCode)
};
})

const requestZendeskAccessToken = (authCode) => {
const url = "https://{SUBDOMAIN}.zendesk.com/oauth/tokens";
const data = {
  'grant_type': 'authorization_code',
  'code': authCode,
  'client_id': '{CLIENT_ID}',
  'client_secret': '{SECRET}',
  'redirect_uri': 'http://localhost:8081/order/search',
  'scope': 'read write'
}

axios.post(url, data, {
  headers: {'Content-Type': 'application/json'}
})
  .then(data => console.log("Successful Access Token Req ", data))
  .catch(err => console.log("Failed Access Token Req ", err));
}

// ...Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

댓글 보기 · 2022년 6월 14일에 편집됨 · IT Support

0

팔로워

1

투표

0

댓글