How do i avoid having to authrorize on every connect. I am testing the LiveCalendarDemo, I do have the key and secret key. The ini file is correctly created, but the program ask for authorization on every connect?
Hi,
I have the same problem. debugged the source (cloudlive.pas) and found out that there is no "refresh_token" in the answer from the server (login.live.com).
In procedure TCloudLive.NavigateComplete2()
Token_Refresh := GetJSONProp(jo,'refresh_token');
is empty because there is no refresh_token in resdat (=server answer). So in live.ini "REFRESH_TOKEN=". On every new start and connect DoAuth is called again.
Any idea how to get a valid refresh_token? Google Calendar works fine.
Hi,
thx. extra scope added and now I get a refresh_token in AdvLiveCalendar1.RefreshAccess. but next line AdvLiveCalendar1.TestTokens returns false because there is no "name" in server answer. So still DoAuth is called on every new start/connect.
procedure TForm1.ButtonConnectClick(Sender: TObject);
begin
AdvLiveCalendar1.Scopes.Add('wl.offline_access');
AdvLiveCalendar1.App.Key := LiveAppKey;
AdvLiveCalendar1.App.Secret := LiveAppSecret;
AdvLiveCalendar1.Logging := true;
if not AdvLiveCalendar1.TestTokens then
AdvLiveCalendar1.RefreshAccess; //True, got refresh_token
//
//TestTokens in next line returns false. in TestTokens in Result := (GetJSONProp(o,'id') <> '') and (GetJSONProp(o,'name') <> ''); there is a prop 'id' <> '' but prop 'name' = ''.
//
if not AdvLiveCalendar1.TestTokens then
AdvLiveCalendar1.DoAuth
else
Init;
end;
The server should return the "name" field if the scopes contain "wl.basic".
This scope is added by default.
It was my fault. In my Microsoft Live account data was no name specified, just my e-mail. After adding my name to my account data everything works fine now. thx for your help.