-
-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SyntaxError: Expected ',' or '}' after property value in JSON at position 280 (line 1 column 281) #1722
Comments
How the cookies are set?
Please answer the above question, so that, I can fix your issue |
import useSignIn from 'react-auth-kit/hooks/useSignIn';
const AUTH_TYPE = 'Bearer'
interface SessionInfoDto {
user: UserDto;
company: CompanyDto;
}
const signIn = useSignIn();
const signInWithTokenAndSessionInfo = useCallback(
(token: string, sessionInfo: SessionInfoDto) => {
signIn({
auth: {
token: token,
type: AUTH_TYPE
},
userState: sessionInfo,
});
setTokenToAppServicesBy(`${AUTH_TYPE} ${token}`, sessionInfo.user?.role);
return true;
},
[signIn],
); Where sessionInfo {
"user": {
"id": "f939f2ba-6358-4c7d-9e4b-863bf2bef8a0",
"email": "[email protected]",
"firstName": "Test",
"lastName": "Test",
"role": "ADMIN",
"middleName": "Test",
"avatar": null,
"agreedTermsOfUse": false,
"fullName": "Test Test Test"
},
"company": {
"id": "243fde28-75ca-49c2-91e6-70e0ad09758a",
"name": "ООО \"Test company\"",
"type": "GENERAL_CONSTRUCTOR",
"phoneNumber": "+988888888888",
"city": "City",
"verified": false
}
} Create store parameters createStore({
authName: 'Test',
authType: 'localstorage',
cookieDomain: window.location.hostname,
cookieSecure: window.location.protocol === 'https:',
debug: true
}); |
@kvandake Thanks for the detailed information. I'll try to reproduce the bug on my system, and try to fix the issue. |
Hello! Has any progress? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Please answer the following questions for yourself before submitting an issue.
When user state same as we get the error
SyntaxError: Expected ',' or '}' after property value in JSON at position 280 (line 1 column 281)
I think the bug in line below because userState.company.name has quotes
https://github.com/react-auth-kit/react-auth-kit/blob/v3.1.3/packages/react-auth-kit/src/RxTokenObject.ts#L508
The text was updated successfully, but these errors were encountered: