wispyco
wispyco
KKinde
Created by wispyco on 9/15/2024 in #💻┃support
Email undefined for apple id registration on dashboard page
When a user registers and is redirected to the dashboard page after signing up I am using the following code to get the user information. import {getKindeServerSession} from "@kinde-oss/kinde-auth-nextjs/server"; export default async function Dashboard() { const {getUser} = getKindeServerSession(); const user = await getUser(); console.log(user); return (<div>Dashboard<pre>{JSON.stringify(user, null, 2)}</pre></div>); } In the console log on the server the email is undefined. Why may this be?
42 replies
KKinde
Created by wispyco on 9/9/2024 in #💻┃support
Machine Api Access Token granted once but not again
I am using NextJS, and I make a request like this below
const token = await fetch(`https://app.kinde.com/oauth2/token`, {
method: "POST",
headers: {
"content-type": "application/x-www-form-urlencoded",
},
body: new URLSearchParams({
audience: `https://wayakumqms.kinde.com/api`,
grant_type: "client_credentials",
client_id: "redacted",
client_secret: KINDE_CLIENT_SECRET!,
}),
})

const tokenData = await token.json();

console.log("tokenData", tokenData.access_token);
const token = await fetch(`https://app.kinde.com/oauth2/token`, {
method: "POST",
headers: {
"content-type": "application/x-www-form-urlencoded",
},
body: new URLSearchParams({
audience: `https://wayakumqms.kinde.com/api`,
grant_type: "client_credentials",
client_id: "redacted",
client_secret: KINDE_CLIENT_SECRET!,
}),
})

const tokenData = await token.json();

console.log("tokenData", tokenData.access_token);
And I get the correct access_token I then eventually make a request to google and get a url for google drive auth I redirect to it and come back to my app with a session ID I then in a different route run the same request as above to get a access_token again so that I can get a token from google drive with the session ID however I get the following error
tokenData undefined
tokenData undefined
Error getting token: {
errors: [
{
code: 'INVALID_CREDENTIALS',
message: 'Invalid credentials used to access API'
}
]
}
POST /api/connected-apps-token 403 in 1333ms
Error getting token: {
errors: [
{
code: 'INVALID_CREDENTIALS',
message: 'Invalid credentials used to access API'
}
]
}
tokenData undefined
tokenData undefined
Error getting token: {
errors: [
{
code: 'INVALID_CREDENTIALS',
message: 'Invalid credentials used to access API'
}
]
}
POST /api/connected-apps-token 403 in 1333ms
Error getting token: {
errors: [
{
code: 'INVALID_CREDENTIALS',
message: 'Invalid credentials used to access API'
}
]
}
Not sure why it didnt worked the second time and did the first. I was under the assumption that this machine api access token shouldnt be stored but called when needed.
5 replies