-
Everything works fine but after redirect with code?= there is an error Response {type: 'cors', url: 'https://jxxxx.io/xx-config-api/ads/oauth2/api-protection-token', redirected: false, status: 405, ok: false, …} export function postWithXForm(url: string, request: TTokenRequest): Promise<Response> {
return fetch(url, {
method: 'POST',
body: buildUrlEncodedRequest(request),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
}).then((response: Response) => {
if (!response.ok) {
console.error(response)
throw Error(response.statusText)
}
return response
})
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This should be fairly simple. The library does a Cross-origin POST request to your token URL. If you are writing this token endpoint yourself, you need to change it to accept POST. If there is someone else who maintain the token API, you should file an issue at them, and tell them to keep to the spec 🙂 |
Beta Was this translation helpful? Give feedback.
This should be fairly simple. The library does a Cross-origin POST request to your token URL.
The token server does not allow for POST requests at that location, which it should per the OAuth2 spec.
If you are writing this token endpoint yourself, you need to change it to accept POST. If there is someone else who maintain the token API, you should file an issue at them, and tell them to keep to the spec 🙂