Finished refresh/user token auth flow
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Need to figoure out expiration and make sure to cycle this appropriately to avoid unnecessary calls
|
||||
import fetch from "node-fetch";
|
||||
|
||||
const fetchEbayReadToken = async () => {
|
||||
const fetchEbayToken = async () => {
|
||||
const ebayClientId = process.env.EBAY_CLIENT_ID;
|
||||
const ebayClientSecret = process.env.EBAY_CLIENT_SECRET;
|
||||
const credentials = Buffer.from(
|
||||
@@ -15,7 +15,7 @@ const fetchEbayReadToken = async () => {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
Authorization: `Basic ${credentials}`,
|
||||
"authorization": `Basic ${credentials}`,
|
||||
},
|
||||
body: "grant_type=client_credentials&scope=https%3A%2F%2Fapi.ebay.com%2Foauth%2Fapi_scope",
|
||||
}
|
||||
@@ -29,6 +29,7 @@ const fetchEbayReadToken = async () => {
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
return data.access_token;
|
||||
} catch (error) {
|
||||
console.error("Error fetching eBay OAuth token:", error);
|
||||
@@ -36,4 +37,4 @@ const fetchEbayReadToken = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
export default fetchEbayReadToken;
|
||||
export default fetchEbayToken;
|
||||
|
||||
Reference in New Issue
Block a user