From bfdc915631be116918f09359855325f05bad7927 Mon Sep 17 00:00:00 2001 From: strNophix Date: Fri, 21 Oct 2022 01:27:02 +0200 Subject: [PATCH] Fixed CORS and trait issue Kratos --- .docker/kratos/default.schema.json | 7 ++++--- .docker/kratos/kratos.yml | 16 ++++++++++++++++ client/.env.sample | 1 + client/components/login/SignupForm.tsx | 1 + 4 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 client/.env.sample diff --git a/.docker/kratos/default.schema.json b/.docker/kratos/default.schema.json index d84cbb0..b8a7e8c 100644 --- a/.docker/kratos/default.schema.json +++ b/.docker/kratos/default.schema.json @@ -1,7 +1,7 @@ { - "$id": "https://schemas.ory.sh/presets/kratos/quickstart/email-password/identity.schema.json", + "$id": "file:///etc/config/kratos/default.schema.json", "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Person", + "title": "default", "type": "object", "properties": { "traits": { @@ -10,6 +10,7 @@ "email": { "type": "string", "format": "email", + "title": "E-Mail", "minLength": 3, "ory.sh/kratos": { "credentials": { @@ -31,7 +32,7 @@ "minLength": 3 } }, - "required": ["email"], + "required": ["email", "username"], "additionalProperties": false } } diff --git a/.docker/kratos/kratos.yml b/.docker/kratos/kratos.yml index 4bdcaba..fba204e 100644 --- a/.docker/kratos/kratos.yml +++ b/.docker/kratos/kratos.yml @@ -1,12 +1,28 @@ version: v0.10.1 dsn: memory +dev: true serve: public: base_url: http://127.0.0.1:4433/ cors: enabled: true + allowed_origins: + - http://127.0.0.1:3000 + allowed_methods: + - POST + - GET + - PUT + - PATCH + - DELETE + allowed_headers: + - Authorization + - Cookie + - Content-Type + exposed_headers: + - Content-Type + - Set-Cookie admin: base_url: http://kratos:4434/ diff --git a/client/.env.sample b/client/.env.sample new file mode 100644 index 0000000..791950a --- /dev/null +++ b/client/.env.sample @@ -0,0 +1 @@ +ORY_SDK_URL=http://localhost:4433 diff --git a/client/components/login/SignupForm.tsx b/client/components/login/SignupForm.tsx index a0e7ea2..078bc14 100644 --- a/client/components/login/SignupForm.tsx +++ b/client/components/login/SignupForm.tsx @@ -45,6 +45,7 @@ const SignupForm: FC = () => { password: data.password, traits: { email: data.email, + username: data.username, }, }) }