Not receiving the accessToken
Hello, when using const{ getAccessToken } = getKindeServerSession() and trying to get the accessToken I get any other thing beside a string with the token ( result attached). Please help.
aud: [],
azp: '',
billing: {
has_payment_details: false,
org_entitlements: null,
plan: {
code: null,
created_on: null,
has_trial_period: null,
invoice_due_on: null,
name: null,
plan_charge_type: null,
trial_expires_on: null
}
},
exp: 1700955875,
iat: 1700869475,
iss: '',
jti: '',
scp: [ 'openid', 'profile', 'email', 'offline' ],
sub: '',
}
10 Replies
i need the accessToken to send it to the backend
I'm also open to any other sugestion on how can I send an authenticated request to the BE
Hi @Sebastian Simionescu,
Thanks for reaching out.
What Kinde SDK are you using? And what version of the SDK are you using?
I’m using next js sdk v2
Hey @Sebastian Simionescu,
Are you using the latest version of the Kinde NextJS SDK v2.0.10?
We have made a lot of key updates on the NextJS SDK that may help you
Hello @Oli - Kinde yes I do. Still getting the same result. It’s an object without any access token
aud: string[];
azp: number;
iat: number;
iss: string;
jti: string;
org_code: string;
permissions: KindePermissions;
scp: string[];
sub: string;
This is the object that I get and I need the string
Hey @Sebastian Simionescu,
Are you able to try the following code instead?
This is code that I’m using @Oli - Kinde
Okay noted, I was suggesting you to use the
await
term.
I will have to get my nextJS expert teammate on this one.
He will look into this 1st thing tomorrow morning.Thanks a lot. I’ll wait for it
No worries, I'm sure we will be able to solve this issue.
Hi @Sebastian Simionescu,
The details you are receiving above is the payload of the access token.
So do you mind elaborating on what exactly you are after?
I get any other thing beside a string with the tokenAre you able to elaborate on this? If I understand you correctly, you want the access token string in it’s raw form. If so, you can get it with the following code: Please let me know if you have any questions.