Quickly Consume a REST API in a .NET Application - REFIT

preview_player
Показать описание
Learn how to use Refit to easily consume a REST API. In this demo, I consume the REST API from my JWT authentication series. I also demonstrate how to setup an automatic token refresh flow on the client.

Although this demo uses Refit to consume a local .NET REST API, Refit can be used to quickly consume any REST API.

TIMESTAMPS:
0:00 - Introduction
1:21 - Installing Refit
1:44 - Demo API Introduction
3:05 - Creating a Refit Service
6:10 - Using the Refit Service
8:08 - Setting Up the Other Refit Services
12:07 - Passing the Access Token to the Data Server
17:52 - Implementing the Automatic Token Refresh
21:59 - Handling Refit Exceptions
13:19 - Conclusion

OTHER LINKS:
Рекомендации по теме
Комментарии
Автор

Thank you for listening to my request, highly appreciated Sean!

leoneguidodalzennaro
Автор

Fantastic tutorial! Great pace and filled with useful information.

robbrodie
Автор

Thank you, Sean! Excellent tutorial!! Thank you, Sean!

AkshayKumar-npix
Автор

Thanks for the effort. Learning so much from all your vids.

samerelsahih
Автор

Hello
Thank you for the great tutorials
I think you may need to make a semantic lock on the refresh method as regular case is having multiple request going out at once, and if all the request are going to request a refresh for the access token this may be at best a redundant request and at worst if the api change the refresh token with each refresh you may end up with invalid refresh token saved as the value on the store

mottahh
Автор

Do we really need one interface for each endpoint? can't we put multiple endpoints in one interface?

igorlima
Автор

any suggestions on how to log / debug the "BODY" of the POST using REFIT. I have a bit more complex JSON with child objects and something is not parsing correctly in the JSON body, but I am unable to figure out how to log that POST message to the console

I do not own the webservice it is POSTing to so I cannot look at logs on receiving side.

bradclarke
Автор

So i suppose in an MVVM architecture, the ICommand's implementing : "CommandBase" are the one's responsible to create the Refit Interfaces instance in there Execute methode ?

tarekjrd
Автор

Hey Sean, where should i save the token for futur logins ?
Assuming that i will redirect the user to the dashboard when he gets a valid token, but how should i save it in a most secure way ?

tarekjrd
Автор

Hello! Did you do the video where you consume third party API with Refit?

randindondan
Автор

The scope of this tutorial is really large. Should rename this video "Consuming Authentication...and BTW, we use refit a little." So many tangents that dive into topics that have nothing to do with Refit that it's like the message gets lost.

godfathermikal
Автор

it looks ridiculous, just for token you have to add so much code, I think there is a better approach

gioeffectpro
join shbcf.ru