miniature-london-86230
03/08/2022, 4:18 AM{
"error": {
"code": 400,
"status": "Bad Request",
"request": "97ff1065-9980-92fc-8d70-e96a5dcc9cd6",
"reason": "Unable to find JSON Schema ID: default",
"message": "The request was malformed or contained invalid parameters"
}
}
Seems simple enough to solve by inputting the correct name. However I cannot find the new default name in the web UI. Can someone tell me what the value for this is?proud-plumber-24205
03/08/2022, 9:29 AM➜ ~ curl -H "Accept: application/json" https://<project_slug>.<http://projects.oryapis.com/api/kratos/public/schemas|projects.oryapis.com/api/kratos/public/schemas> | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 530 100 530 0 0 1444 0 --:--:-- --:--:-- --:--:-- 1440
[
{
"id": "<preset://email>",
"schema": {
"$id": "<https://schemas.ory.sh/presets/kratos/identity.email.schema.json>",
"$schema": "<http://json-schema.org/draft-07/schema#>",
"title": "Person",
"type": "object",
"properties": {
"traits": {
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email",
"title": "E-Mail",
"<http://ory.sh/kratos|ory.sh/kratos>": {
"credentials": {
"password": {
"identifier": true
},
"totp": {
"account_name": true
}
},
"recovery": {
"via": "email"
},
"verification": {
"via": "email"
}
},
"maxLength": 320
}
},
"required": [
"email"
],
"additionalProperties": false
}
}
}
}
]
I can see the id
of my schema is <preset://email>
To now create an identity we can do
➜ ~ curl -X POST -H "Accept: application/json" -H "Authorization: Bearer ory_pat_<token>" https://<project_slug>.<http://projects.oryapis.com/api/kratos/admin/identities|projects.oryapis.com/api/kratos/admin/identities> --data '{"schema_id": "<preset://email>", "traits":{"email":"<mailto:bob1234@example.com|bob1234@example.com>"}}' | jq
{
"id": "fa26083d-77c7-4c1e-afec-ba9c91dd699d",
"schema_id": "<preset://email>",
"schema_url": "https://<project_slug>.<http://projects.oryapis.com/api/kratos/public/schemas/cHJlc2V0Oi8vZW1haWw|projects.oryapis.com/api/kratos/public/schemas/cHJlc2V0Oi8vZW1haWw>",
"state": "active",
"state_changed_at": "2022-03-08T09:25:32.549155347Z",
"traits": {
"email": "<mailto:bob1234@example.com|bob1234@example.com>"
},
"verifiable_addresses": [
{
"id": "92a54da2-2ab7-4483-a66f-e413cc815f4d",
"value": "<mailto:bob1234@example.com|bob1234@example.com>",
"verified": false,
"via": "email",
"status": "pending",
"created_at": "2022-03-08T09:25:32.562564Z",
"updated_at": "2022-03-08T09:25:32.562564Z"
}
],
"recovery_addresses": [
{
"id": "a670062f-24d7-4cc6-a639-62cf38527e28",
"value": "<mailto:bob1234@example.com|bob1234@example.com>",
"via": "email",
"created_at": "2022-03-08T09:25:32.571982Z",
"updated_at": "2022-03-08T09:25:32.571982Z"
}
],
"created_at": "2022-03-08T09:25:32.553524Z",
"updated_at": "2022-03-08T09:25:32.553524Z"
}
miniature-london-86230
03/09/2022, 4:55 AMToSession
method returns a *Session object but that does not include what appears to be needed. The documentation is looking for a SessionToken but that field is not on the struct.proud-plumber-24205
03/09/2022, 7:03 AMminiature-london-86230
03/09/2022, 1:33 PMapp.session
entity from the login at logout, but that does not appear to be possible. Can you provide a concrete example of what to do based on the login workflow. Also are the docs I shared the best place for devs try to keep up with the cloud SDK? Thank you!proud-plumber-24205
03/09/2022, 2:05 PMminiature-london-86230
03/09/2022, 2:31 PMAre you retrieving a cookie like in the tutorial?Yes. I expected the Session to have a
SessionToken
field which would be trivial to pass to any of methods available on the SDK version I am using (alpha.116)miniature-london-86230
03/09/2022, 2:33 PMminiature-london-86230
03/09/2022, 2:34 PMsession
value to contain something I could use to logout but it appears more is needed?miniature-london-86230
03/09/2022, 2:35 PM// check if we have a session
session, _, err := app.ory.V0alpha2Api.ToSession(request.Context()).Cookie(cookies).Execute()
if (err != nil && session == nil) || (err == nil && !*session.Active) {
// this will redirect the user to the managed Ory Login UI
http.Redirect(writer, request, "/.ory/api/kratos/public/self-service/login/browser", http.StatusSeeOther)
return
}
app.cookies = cookies
app.session = session
Specifically the session
is this https://github.com/ory/client-go/blob/master/docs/Session.md. What field can I use to support logout and what method should I use from the client-go
packageminiature-london-86230
03/09/2022, 2:37 PMproud-plumber-24205
03/09/2022, 2:40 PMproud-plumber-24205
03/09/2022, 2:40 PMminiature-london-86230
03/09/2022, 2:42 PMproud-plumber-24205
03/09/2022, 2:42 PMminiature-london-86230
03/09/2022, 2:45 PMminiature-london-86230
03/09/2022, 4:45 PM