casdoor / casdoor-go-sdk

Go client SDK for Casdoor
https://github.com/casdoor/casdoor
Apache License 2.0
88 stars 74 forks source link

Delete Token problem with "name" parameter #124

Closed DenisBytes closed 1 month ago

DenisBytes commented 1 month ago

Version: v0.47.0

This is not really an issue but more of a suggestion.

When calling the method:

casdoorsdk.GetToken(name string)

it requires the JWT ID (ex. of a JWT ID, "admin/07ed1609-80e0-4dac-8a2c-e2dbbbac85c3")

But if you pass the full string just like the example it returns:

"invalid character '<' looking for beginning of value"

Looking into the method definition i found why it gave an error:

image

Is that the method does the formatting itself. I haven't tried other the GetX methods but i suppose they do it where needed.

Quick Solution is to use the path.Base() standard library method:

image

But it's better if there's documentation above the method

casbin-bot commented 1 month ago

@tangyang9464 @JalinWang @imp2002

hsluoyz commented 1 month ago

@DenisBytes what do you pass? What got and what to expect?

DenisBytes commented 1 month ago

The full text. "admin/07ed1609-80e0-4dac-8a2c-e2dbbbac85c3" but instead it just requires. "07ed1609-80e0-4dac-8a2c-e2dbbbac85c3".

As i said it's just a suggestion not really an issue.

Just add documentation

hsluoyz commented 1 month ago

No much need to add docs, all APIs are like that. People need to adapt themselves to use Casdoor SDK. Need to think in "the Casdoor way"