Skip to content
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

[Go] Cannot get Identity results after Register with Kratos SDK v1.0.0 #292

Open
5 tasks done
bcordobaq opened this issue Sep 11, 2023 · 1 comment
Open
5 tasks done
Labels
bug Something is not working.

Comments

@bcordobaq
Copy link

Preflight checklist

Ory Network Project

No response

Describe the bug

Implementing the register identity method with the Ory Kratos SDK (kratos-client-go) v1.0.0, I noticed that the SDK is not returning the result object with the created identity. However, the identity is correctly processed and it's mapped in the response object.
With kratos-client-go v0.13.0 it works well.

Reproducing the bug

having this snippet of go code to register, using github.com/ory/kratos-client-go v1.0.0:

package main

import (
	"context"
	"fmt"
	"log"
	"net/http/httputil"

	kratos "github.com/ory/kratos-client-go"
)

func main() {
	client := kratos.NewAPIClient(
		&kratos.Configuration{
			Servers: kratos.ServerConfigurations{
				{
					URL: "http://localhost:4433",
				},
			},
		})

	ctx := context.Background()

	// Initialize the flow
	flow, _, err := client.FrontendApi.CreateNativeRegistrationFlow(ctx).Execute()
	if err != nil {
		log.Fatal("cannot init register flow: ", err)
	}

	// Submit the registration flow
	result, resp, err := client.FrontendApi.UpdateRegistrationFlow(ctx).Flow(flow.Id).UpdateRegistrationFlowBody(
		kratos.UpdateRegistrationFlowBody{
			UpdateRegistrationFlowWithPasswordMethod: &kratos.UpdateRegistrationFlowWithPasswordMethod{
				Method:   "password",
				Password: "<your-password>",
				Traits:   map[string]interface{}{"email": "test@test.com"},
			}}).Execute()
	if err != nil {
		log.Fatal("cannot register identity: ", err)
	}

	fmt.Printf("identity result: %+v\n", result)
	respData, _ := httputil.DumpResponse(resp, true)
	fmt.Println(string(respData))
}

Relevant log output

identity result: &{ContinueWith:[] Identity:{CreatedAt:<nil> Credentials:<nil> Id: MetadataAdmin:<nil> MetadataPublic:<nil> RecoveryAddresses:[] SchemaId: SchemaUrl: State:<nil> StateChangedAt:<nil> Traits:<nil> UpdatedAt:<nil> VerifiableAddresses:[] AdditionalProperties:map[]} Session:<nil> SessionToken:<nil> AdditionalProperties:map[]}



HTTP/1.1 200 OK
Transfer-Encoding: chunked
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Type: application/json; charset=utf-8
Date: Mon, 11 Sep 2023 02:57:53 GMT
Vary: Cookie

945
{"session_token":"ory_st_9HhKxmrgAF1GP57VAynBW7BMTT4jutxB","session":{"id":"2d50d4db-b645-4819-8bff-73fb3ffc56a5","active":true,"expires_at":"2023-09-12T02:57:53.688934128Z","authenticated_at":"2023-09-11T02:57:53.69437967Z","authenticator_assurance_level":"aal1","authentication_methods":[{"method":"password","aal":"aal1","completed_at":"2023-09-11T02:57:53.688933753Z"}],"issued_at":"2023-09-11T02:57:53.688934128Z","identity":{"id":"4e3b29a1-b9cf-4baa-98ad-f8d51d430ea8","schema_id":"default","schema_url":"http://localhost:4433/schemas/ZWNseXBzaXVt","state":"active","state_changed_at":"2023-09-11T02:57:53.682665378Z","traits":{"email":"test@test.com"},"verifiable_addresses":[{"id":"a947fe0f-6c83-45dd-8dae-442a0bdd267d","value":"test@test.com","verified":false,"via":"email","status":"sent","created_at":"2023-09-11T02:57:53.685776Z","updated_at":"2023-09-11T02:57:53.685776Z"}],"recovery_addresses":[{"id":"1b97a3a1-7f2e-495d-bb39-750c9399eb09","value":"test@test.com","via":"email","created_at":"2023-09-11T02:57:53.686579Z","updated_at":"2023-09-11T02:57:53.686579Z"}],"metadata_public":null,"created_at":"2023-09-11T02:57:53.685295Z","updated_at":"2023-09-11T02:57:53.685295Z"},"devices":[{"id":"1e575e28-3f4f-41d5-aec0-0bf812ac007e","ip_address":"172.23.0.1:57696","user_agent":null,"location":""}]},"identity":{"id":"4e3b29a1-b9cf-4baa-98ad-f8d51d430ea8","schema_id":"default","schema_url":"http://localhost:4433/schemas/ZWNseXBzaXVt","state":"active","state_changed_at":"2023-09-11T02:57:53.682665378Z","traits":{"email":"test@test.com"},"verifiable_addresses":[{"id":"a947fe0f-6c83-45dd-8dae-442a0bdd267d","value":"test@test.com","verified":false,"via":"email","status":"sent","created_at":"2023-09-11T02:57:53.685776Z","updated_at":"2023-09-11T02:57:53.685776Z"}],"recovery_addresses":[{"id":"1b97a3a1-7f2e-495d-bb39-750c9399eb09","value":"test@test.com","via":"email","created_at":"2023-09-11T02:57:53.686579Z","updated_at":"2023-09-11T02:57:53.686579Z"}],"metadata_public":null,"created_at":"2023-09-11T02:57:53.685295Z","updated_at":"2023-09-11T02:57:53.685295Z"},"continue_with":[{"action":"show_verification_ui","flow":{"id":"e207243e-e07b-48f6-9198-ea8f5dc93979","verifiable_address":"test@test.com"}},{"action":"set_ory_session_token","ory_session_token":"ory_st_9HhKxmrgAF1GP57VAynBW7BMTT4jutxB"}]}

0

Relevant configuration

No response

Version

v1.0.0

On which operating system are you observing this issue?

None

In which environment are you deploying?

Docker Compose

Additional Context

No response

@bcordobaq bcordobaq added the bug Something is not working. label Sep 11, 2023
@bcordobaq bcordobaq changed the title Cannot get RegisterIdentity results from Kratos SDK v1.0.0 Cannot get Identity results after Register with Kratos SDK v1.0.0 Sep 11, 2023
@bcordobaq
Copy link
Author

@aeneasr any updates on this?

@bcordobaq bcordobaq changed the title Cannot get Identity results after Register with Kratos SDK v1.0.0 [Go] Cannot get Identity results after Register with Kratos SDK v1.0.0 Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

1 participant