In a background app i am able to use saved token string to get attachment info, but when i try to use refresh token for some bigger file i got error message:
Content: { "error" : "invalid_grant", "errors" : [ { "errorCode" : "OAU-202", "message" : "Refresh token is invalid because it was issued for a different application" } ], "error_description" : "Refresh token is invalid because it was issued for a different application" }
Request:
Method: POST, RequestUri: 'https://platform.devtest.ringcentral.com/restapi/oauth/token', Version: 1.1, Content: System.Net.Http.FormUrlEncodedContent, Headers: { X-User-Agent: Unknown/0.0.1 RingCentral.Net/5.2.0 Authorization: Basic aEJXMElab3lRc1dPcDVjdWgwYXN0UTpCak1BcnJnWVNkeVMyWkJIbzNnUmlBZk1vZjFZTG1SU3FRUU41YUVTN21LQQ== Content-Type: application/x-www-form-urlencoded Content-Length: 369 }
The code i am using like following:
rc.token = JsonConvert.DeserializeObject<TokenInfo>(tokenString); try { TestRefresh(tokenString).Wait(); } catch (Exception ex) { var s = ex.Message; } Authorized = true; public async Task TestRefresh(string tokenString) { var token = JsonConvert.DeserializeObject<TokenInfo>(tokenString); token = await rc.Authorize(new GetTokenRequest { grant_type = "refresh_token", refresh_token = token.refresh_token, access_token_ttl = 1800, refresh_token_ttl = 302400 }); rc.token = token; }
TestRefresh always failed, how to make refresh work?
Thanks.