From 16ff9b8a7f20cd70a7ada9c7e9428df7a17b39be Mon Sep 17 00:00:00 2001 From: Jonas Dellinger Date: Mon, 11 Nov 2019 17:01:23 +0100 Subject: [PATCH] Updated docs regarding Refresh of Tokens and fixed dead links --- SpotifyAPI.Docs/docs/auth/authorization_code.md | 16 ++++++++++++++++ SpotifyAPI.Docs/docs/auth/getting_started.md | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/SpotifyAPI.Docs/docs/auth/authorization_code.md b/SpotifyAPI.Docs/docs/auth/authorization_code.md index 7b75bb65..18c5f692 100644 --- a/SpotifyAPI.Docs/docs/auth/authorization_code.md +++ b/SpotifyAPI.Docs/docs/auth/authorization_code.md @@ -37,3 +37,19 @@ static async void Main(string[] args) auth.OpenBrowser(); } ``` + +## Token Refresh + +Once the `AccessToken` is expired, you can use your `RefreshToken` to get a new one. +In this procedure, no HTTP Server is needed in the background and a single HTTP Request is made. + +```csharp +// Auth code from above + +if(token.IsExpired()) +{ + Token newToken = await auth.RefreshToken(token.RefreshToken); + api.AccessToken = newToken.AccessToken + api.TokenType = newToken.TokenType +} +``` \ No newline at end of file diff --git a/SpotifyAPI.Docs/docs/auth/getting_started.md b/SpotifyAPI.Docs/docs/auth/getting_started.md index 56d88c34..177050f5 100644 --- a/SpotifyAPI.Docs/docs/auth/getting_started.md +++ b/SpotifyAPI.Docs/docs/auth/getting_started.md @@ -20,9 +20,9 @@ Now you can start with the user-authentication, Spotify provides 3 ways (4 if yo * [TokenSwapAuth](/auth/token_swap.md) (**Recommended**, server-side code mandatory, most secure method. The necessary code is shown here so you do not have to code it yourself.) -* [AutorizationCodeAuth](/auth/autorization_code.md) (Not recommended, server-side code needed, else it's unsecure) +* [AutorizationCodeAuth](/auth/authorization_code.md) (Not recommended, server-side code needed, else it's unsecure) -* [ClientCredentialsAuth](/auth/client_credentials_auth.md) (Not recommended, server-side code needed, else it's unsecure) +* [ClientCredentialsAuth](/auth/client_credentials.md) (Not recommended, server-side code needed, else it's unsecure) Overview: ![Overview](http://i.imgur.com/uf3ahTl.png)