You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a custom configuration for Bullhorn, I was wondering if there was a way I could get the same results with less code. I tried to run the configuration with just the URLs for the userInfo and Token params but I found I needed to write my own functions otherwise I was getting 401 errors.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi -
I'm writing a custom configuration for Bullhorn, I was wondering if there was a way I could get the same results with less code. I tried to run the configuration with just the URLs for the userInfo and Token params but I found I needed to write my own functions otherwise I was getting 401 errors.
code is below, suggestions welcomed
async function makeTokenRequest(context){
const url = 'https://auth-west.bullhornstaffing.com/oauth/token';
let data = new URLSearchParams({
grant_type: 'authorization_code',
code: context.params.code,
client_id : process.env.BULLHORN_ID,
client_secret: process.env.BULLHORN_SECRET,
redirect_uri: 'http://localhost:3000/api/auth/callback/bullhorn'
});
let res = await fetch(url, {
method: 'POST', // *GET, POST, PUT, DELETE, etc.
headers: {'content-type': 'application/x-www-form-urlencoded'},
body: data
});
const content = await res.json();
console.log(content)
return {
access_token: content.access_token,
accessToken: content.access_token,
token_type: 'Bearer',
expires_in: content.expires_in,
expires_val : 600,
accessTokenExpires : Date.now() + content.expires_in * 1000,
expires_at: Date.now() + content.expires_in * 1000,
refresh_token: content.refresh_token,
}
}
export default NextAuth({
providers: [
Beta Was this translation helpful? Give feedback.
All reactions