bright-policeman-41717
01/09/2023, 5:00 PM_, _, err := client.OAuth2Api.CreateOAuth2Client(context.Background()).
OAuth2Client(ory.OAuth2Client{
ClientId: pointer.ToString("clientId"),
ClientName: pointer.ToString("clientName"),
ClientSecret: pointer.ToString("clientSecret"),
GrantTypes: []string{"authorization_code", "refresh_token"},
RedirectUris: []string{"<https://www.ory.sh/>"},
ResponseTypes: []string{"code", "id_token"},
Scope: pointer.ToString("openid offline"),
TokenEndpointAuthMethod: pointer.ToString("client_secret_post"),
Metadata: nil,
}).Execute()
bright-policeman-41717
01/09/2023, 5:01 PMbright-policeman-41717
01/09/2023, 5:01 PMjson: cannot unmarshal object into Go struct field ErrorOAuth2.error of type string
bright-policeman-41717
01/09/2023, 5:02 PMbright-policeman-41717
01/09/2023, 5:12 PMvar oryAuthedContext = context.WithValue(context.Background(), ory.ContextAccessToken, "ory_pat_ACe9oVHW")
bright-policeman-41717
01/09/2023, 5:13 PMproud-plumber-24205
01/10/2023, 12:32 PMbright-policeman-41717
01/10/2023, 2:05 PM{
"body": {
"Reader": {}
},
"error": "400 Bad Request",
"status": "400 Bad Request"
}
bright-policeman-41717
01/10/2023, 2:05 PMbright-policeman-41717
01/10/2023, 2:23 PMfunc (h *Handler) CreateOauthClientHandler(c *gin.Context) {
// metaData := map[string]interface{}{
// "registration": os.Getenv("OAUTH_REGISTRATION"),
// }
// clientId := os.Getenv("CLIENT_ID")
// clientSecret := os.Getenv("CLIENT_SECRET")
// clientName := os.Getenv("CLIENT_NAME")
// redirectUris := os.Getenv("REDIRECT_URIS")
log.Println(h.ctx.Value(ory.ContextAccessToken))
_, res, err := h.ApiClient.OAuth2Api.CreateOAuth2Client(h.ctx).
OAuth2Client(ory.OAuth2Client{
ClientId: pointer.ToString("test-client"),
ClientName: pointer.ToString("auth-client-test"),
ClientSecret: pointer.ToString("secret"),
GrantTypes: []string{"authorization_code", "refresh_token"},
RedirectUris: []string{"<http://localhost:3000/callback>"},
ResponseTypes: []string{"code", "id_token"},
Scope: pointer.ToString("openid offline"),
TokenEndpointAuthMethod: pointer.ToString("client_secret_post"),
}).Execute()
defer res.Body.Close()
if err != nil {
h.logger.Println(err.Error())
c.JSON(500, gin.H{
"error": err.Error(),
"status": res.Status,
"body": res.Body,
})
return
}
c.JSON(200, gin.H{
"message": "Oauth2.0 client created successfully",
})
}
proud-plumber-24205
01/10/2023, 3:57 PMbright-policeman-41717
01/10/2023, 4:06 PM&{400 Bad Request 400 HTTP/2.0 2 0 map[Alt-Svc:[h3=":443"; ma=86400, h3-29=":443"; ma=86400] Cache-Control:[private, no-cache, no-store, must-revalidate] Cf-Cache-Status:[DYNAMIC] Cf-Ray:[7876a8c85d119638-DEL] Content-Length:[201] Content-Type:[application/json] Date:[Tue, 10 Jan 2023 16:06:20 GMT] Server:[cloudflare] Set-Cookie:[__cflb=0pg1SGLfsntzdyWGAy13P2Jp3U9FyhvDwBgd6Jfu; SameSite=None; Secure; path=/; expires=Tue, 10-Jan-23 17:06:20 GMT; HttpOnly] Vary:[Origin]] {{"error":"The request was malformed or contained invalid parameters","error_description":"It is no longer possible to set an OAuth2 Client ID as a user. The system will generate a unique ID for you."}
} 201 [] false false map[] 0x14000570400 0x140001e4370}
proud-plumber-24205
01/10/2023, 4:07 PMbright-policeman-41717
01/10/2023, 4:08 PMbright-policeman-41717
01/10/2023, 4:09 PMproud-plumber-24205
01/10/2023, 4:10 PMbright-policeman-41717
01/10/2023, 4:10 PM