Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth Token Endpoint change #339

Closed
gsreynolds opened this issue Nov 1, 2023 · 0 comments · Fixed by #343
Closed

OAuth Token Endpoint change #339

gsreynolds opened this issue Nov 1, 2023 · 0 comments · Fixed by #343
Assignees
Labels
task Housekeeping tasks to improve code base
Milestone

Comments

@gsreynolds
Copy link
Member

export const exchangeCodeForToken = async (
clientId,
clientSecret,
redirectURL,
codeVerifier,
code,
) => {
// eslint-disable-next-line no-unused-vars
const postData = async (url, _data) => {
const response = await fetch(url, {
method: 'POST',
});
const json = response.json();
return json;
};
const requestTokenUrl = 'https://identity.pagerduty.com/oauth/token?'
+ 'grant_type=authorization_code&'
+ `code=${code}&`
+ `redirect_uri=${redirectURL}&`
+ `client_id=${clientId}&`
+ `client_secret=${clientSecret}&`
+ `code_verifier=${codeVerifier}`;
const data = await postData(requestTokenUrl, {});
if (data.access_token) {
return data.access_token;
}
return null;
};

@gsreynolds gsreynolds added this to the v0.11.0 milestone Nov 1, 2023
@gsreynolds gsreynolds added the task Housekeeping tasks to improve code base label Nov 1, 2023
@gsreynolds gsreynolds linked a pull request Nov 10, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task Housekeeping tasks to improve code base
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants