From e2b93d022a365ef0a30a15e2aef3c6ef430de7c7 Mon Sep 17 00:00:00 2001 From: LuizFNJ Date: Wed, 27 Nov 2024 18:27:48 +0100 Subject: [PATCH 1/2] update the Readme --- README.md | 105 +++++++++++++++++++++++++++++------------------------- 1 file changed, 57 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index d4329fc98..165578f35 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,10 @@ cp config/localConfig.example.ts config/localConfig.ts ``` sh yarn seed ``` +- Run the command below to update the users' affiliations: + ``` sh + ./node_modules/.bin/ts-node ./server/scripts/updateAllUsersAppAffiliation.ts + ``` ## Build to production - The build step should be run as follow: @@ -88,57 +92,61 @@ Check if users were created successfully by accessing the identities page: ### Ory Cloud #### Taking What You Need: - Create an account and a project on https://console.ory.sh/login. -- Copy the SDK Configuration url and save it. -- Scroll down in the same page and create a Personal Access Tokens, copy the acess token that gonna show up on the bottom of your screen and save it. -- Go to Identity Schema and click on Customize Identity Schema then change the actual schema to the code below and click Update after the change: +- In Project settings, copy the SDK configuration URL and save it. +- On the same page, in API keys, create a new API key, copy it, and save it. +- Go to User Management in Identity Schema and click on Duplicate Identity Schema. Then, update the current schema with the code below and click Save after making the changes: ``` { - "$id": "https://schemas.ory.sh/presets/kratos/identity.email.schema.json", - "title": "Person", - "type": "object", - "properties": { - "traits": { - "type": "object", - "properties": { - "email": { - "type": "string", - "format": "email", - "title": "E-Mail", - "ory.sh/kratos": { - "credentials": { - "password": { - "identifier": true - }, - "webauthn": { - "identifier": true - }, - "totp": { - "account_name": true - } - }, - "recovery": { - "via": "email" + "$id": "https://schemas.ory.sh/presets/kratos/identity.email.schema.json", + "title": "Person", + "type": "object", + "properties": { + "traits": { + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "title": "E-Mail", + "ory.sh/kratos": { + "credentials": { + "password": { + "identifier": true + }, + "webauthn": { + "identifier": true + }, + "totp": { + "account_name": true + } + }, + "recovery": { + "via": "email" + }, + "verification": { + "via": "email" + } + }, + "maxLength": 320 + }, + "user_id": { + "type": "string" + }, + "role": { + "type": "object" + }, + "app_affiliation": { + "type": "string", + "description": "The application the user belongs to" + } }, - "verification": { - "via": "email" - } - }, - "maxLength": 320 - }, - "user_id": { - "type": "string" - }, - "role": { - "type": "object" + "required": [ + "email", + "user_id" + ], + "additionalProperties": false } - }, - "required": [ - "email", - "user_id" - ], - "additionalProperties": false } - } } ``` - Go to SDK Configuration url that you saved and add /schemas in the end of the url then copy the first id on the page and save it. @@ -147,8 +155,9 @@ Check if users were created successfully by accessing the identities page: #### Making The Changes On Your Code: - First you gonna have to change the ``authentication_type: `` to ory on your config.yaml and config.seed.yaml. - Now take SDK Configuration url and paste on ``url: `` in both pages config.yaml, config.seed.yaml and on ``ORY_SDK_URL=`` in your .env too. -- Now Paste the acess token that you saved on ``access_token: `` in your config.yaml and config.seed.yaml. -- Do the same as above but now with the id that you saved and paste it on ``schema_id: ``. +- Now Paste the acess token that you saved on ``access_token: `` in your config.yaml and config.seed.yaml and on +``ORY_ACCESS_TOKEN=`` in your .env too. +- Do the same as above, but now with the Schema ID you saved, and paste it into ``schema_id`` and on ``ALETHEIA_SCHEMA_ID=`` in .env. #### Setting up your own UI to make the right redirects: - Go to User Interface on Ory Console and rewrite these fields: Login UI with http://localhost:3000/login and Settings UI with http://localhost:3000/profile. From a35356b954fe3a0995fe44754cd76db76d2a162e Mon Sep 17 00:00:00 2001 From: LuizFNJ Date: Wed, 27 Nov 2024 19:35:48 +0100 Subject: [PATCH 2/2] remove schema JSON and adding link to it --- README.md | 56 +------------------------------------------------------ 1 file changed, 1 insertion(+), 55 deletions(-) diff --git a/README.md b/README.md index 165578f35..29f110c55 100644 --- a/README.md +++ b/README.md @@ -94,61 +94,7 @@ Check if users were created successfully by accessing the identities page: - Create an account and a project on https://console.ory.sh/login. - In Project settings, copy the SDK configuration URL and save it. - On the same page, in API keys, create a new API key, copy it, and save it. -- Go to User Management in Identity Schema and click on Duplicate Identity Schema. Then, update the current schema with the code below and click Save after making the changes: -``` -{ - "$id": "https://schemas.ory.sh/presets/kratos/identity.email.schema.json", - "title": "Person", - "type": "object", - "properties": { - "traits": { - "type": "object", - "properties": { - "email": { - "type": "string", - "format": "email", - "title": "E-Mail", - "ory.sh/kratos": { - "credentials": { - "password": { - "identifier": true - }, - "webauthn": { - "identifier": true - }, - "totp": { - "account_name": true - } - }, - "recovery": { - "via": "email" - }, - "verification": { - "via": "email" - } - }, - "maxLength": 320 - }, - "user_id": { - "type": "string" - }, - "role": { - "type": "object" - }, - "app_affiliation": { - "type": "string", - "description": "The application the user belongs to" - } - }, - "required": [ - "email", - "user_id" - ], - "additionalProperties": false - } - } -} -``` +- Go to User Management in Identity Schema and click on Duplicate Identity Schema. Then, update the current schema to [IdentitySchema.JSON](https://github.com/AletheiaFact/aletheia/blob/stage/ory_config/identity.schema.json) and click Save after making the changes: - Go to SDK Configuration url that you saved and add /schemas in the end of the url then copy the first id on the page and save it. - If you want to check if it is the right id, at the same url paste after /schemas the / contaning the id that you just copied.