feat(WEB-169): get profile data from API
This commit is contained in:
24
auth.ts
24
auth.ts
@@ -18,7 +18,7 @@ const customProvider = {
|
||||
authorization: {
|
||||
url: `${env.CURITY_ISSUER_USER}/oauth/v2/authorize`,
|
||||
params: {
|
||||
scope: ["openid"],
|
||||
scope: ["openid", "profile"].join(" "),
|
||||
/**
|
||||
* The `acr_values` param is used to make Curity display the proper login
|
||||
* page for Scandic. Without the parameter Curity presents some choices
|
||||
@@ -53,9 +53,9 @@ export const config = {
|
||||
strategy: "jwt",
|
||||
},
|
||||
callbacks: {
|
||||
async signIn(...args) {
|
||||
async signIn() {
|
||||
console.log("****** SIGN IN *******")
|
||||
console.log(args)
|
||||
console.log(arguments)
|
||||
console.log("****** END - SIGN IN *******")
|
||||
return true
|
||||
},
|
||||
@@ -68,6 +68,7 @@ export const config = {
|
||||
if (session.user) {
|
||||
return {
|
||||
...session,
|
||||
token,
|
||||
user: {
|
||||
...session.user,
|
||||
id: token.sub,
|
||||
@@ -107,22 +108,27 @@ export const config = {
|
||||
console.log("****** END - AUTHORIZED *******")
|
||||
return true
|
||||
},
|
||||
async jwt({ session, token, trigger }) {
|
||||
async jwt({ session, token, trigger, account }) {
|
||||
console.log("****** JWT *******")
|
||||
console.log({ session, token, trigger })
|
||||
console.log({ session, token, trigger, account })
|
||||
console.log("****** END - JWT *******")
|
||||
if (account) {
|
||||
return {
|
||||
access_token: account.access_token,
|
||||
}
|
||||
}
|
||||
return token
|
||||
},
|
||||
},
|
||||
events: {
|
||||
async signIn(...args) {
|
||||
async signIn() {
|
||||
console.log("#### SIGNIN EVENT ARGS ######")
|
||||
console.log(args)
|
||||
console.log(arguments)
|
||||
console.log("#### END - SIGNIN EVENT ARGS ######")
|
||||
},
|
||||
async session(...args) {
|
||||
async session() {
|
||||
console.log("#### SESSION EVENT ARGS ######")
|
||||
console.log(args)
|
||||
console.log(arguments)
|
||||
console.log("#### END - SESSION EVENT ARGS ######")
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user