44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import {NuxtAuthHandler} from '#auth'
|
|
|
|
export default NuxtAuthHandler({
|
|
secret: "my-cool-secret",
|
|
providers: [
|
|
{
|
|
id: "default",
|
|
name: "default",
|
|
type: "oauth",
|
|
wellKnown: "",
|
|
clientId: "",
|
|
clientSecret: "",
|
|
authorization: {
|
|
params: {
|
|
scope: "openid email profile"
|
|
}
|
|
},
|
|
idToken: true,
|
|
// checks: [ "pkce", "state" ],
|
|
profile(profile) {
|
|
return {
|
|
id: profile.sub,
|
|
name: profile.name,
|
|
email: profile.email,
|
|
}
|
|
}
|
|
}
|
|
],
|
|
callbacks: {
|
|
async jwt({ token, account }) {
|
|
// Persist the access token to the token right after signin
|
|
if (account) {
|
|
token.accessToken = account.access_token;
|
|
}
|
|
return token;
|
|
},
|
|
async session({ session, token }) {
|
|
// Send properties to the client
|
|
session.accessToken = token.accessToken;
|
|
return session;
|
|
}
|
|
}
|
|
});
|