softwerkab / fortnox-csharp-api-sdk

.NET SDK for Fortnox API.
MIT License
52 stars 64 forks source link

Revoke refresh token #224

Closed martenw closed 2 years ago

martenw commented 2 years ago

https://developer.fortnox.se/general/revoke-access-token/

Is revoke supported using this package?

richardrandak commented 2 years ago

Not at the moment. I'll add it.

martenw commented 2 years ago

Great, thank you!

richardrandak commented 2 years ago

I have created a preview NuGet - https://www.nuget.org/packages/Fortnox.NET.SDK/4.2.9-rc

I have added the two revocation methods to the StandardAuthWorkflow.. I noticed it gives me success even for made-up tokens.

I tested revocation of refresh token, it works -> the revoked refresh token becomes invalid. I could not test revocation of legacy tokens, since I don't have any I could revoke.. the ones I have I need :)

Please let me know if it works for you.

richardrandak commented 2 years ago

I wonder if it is actually possible to have a OK response and "not revoked" token. I assume, if the revocation fails, it will result in http error response.

{
  "revoked": false
}
martenw commented 2 years ago

I have not tested the direct api call myself, not clear from documentation what the api returns on invalid token or revoke failed.

richardrandak commented 2 years ago

Speaking to support, it should indicate if the token was invalidated (true) or was already invalid (false). However, in reality, i am always getting "true", even if the token is made-up.

martenw commented 2 years ago

Ok, thank you for the update.

Sorry for not getting back on testing, have not had time to implement and test the new feature yet. Will post an update here when done.