@coursebuilder/core
Version:
Core package for Course Builder
47 lines (46 loc) • 1.19 kB
JavaScript
import {
__name
} from "../chunk-VLQXSCFN.js";
// src/providers/egghead.ts
function egghead(config) {
return {
id: "egghead",
name: "egghead",
type: "oauth",
token: "https://app.egghead.io/oauth/token",
authorization: {
url: "https://app.egghead.io/oauth/authorize?response_type=code",
params: {
scope: ""
}
},
userinfo: {
url: "https://app.egghead.io/api/v1/users/current",
async request({ tokens, provider }) {
const profile = await fetch(provider.userinfo?.url, {
headers: {
Authorization: `Bearer ${tokens.access_token}`,
"User-Agent": "authjs"
}
}).then(async (res) => await res.json());
return profile;
}
},
profile(profile) {
return {
id: profile.id,
name: profile.name,
email: profile.email,
image: profile.avatar_url
};
},
clientId: config.clientId,
clientSecret: config.clientSecret,
allowDangerousEmailAccountLinking: config.allowDangerousEmailAccountLinking
};
}
__name(egghead, "egghead");
export {
egghead as default
};
//# sourceMappingURL=egghead.js.map