Jump to content

ZRomik

Members
  • Content Count

    54
  • Joined

  • Last visited

Posts posted by ZRomik


  1. I'm watching  in "OverbyteIcsHttpRestTst" and trying to reproduce this in my app, but always got error "Failed to generate app token.

     App Authorization Code: blah-blah-blah". When I set parameters in demo app all ok. What I'm doing wrong?

    My code:

    const
      sAuthURL            = 'https://login.eveonline.com/v2/oauth/authorize/';
      sRedirectURI        = 'http://localhost:5561/';
        sSecretKey        = '...';
     sTokenURL            = 'https://login.eveonline.com/oauth/token';
        sClientID         = '...';
        sScopeList        = 'esi-location.read_location.v1';
        sLocalAddr        = '127.0.0.1';
        sLocalPort        = '5561';
    	sTokenURL     = 'https://login.eveonline.com/oauth/token';
    
    
    procedure TForm1.imgLoginClick(Sender: TObject);
    begin
      mem1.Lines.Clear;
      SetupOAuth;
      if rest.StartAuthorization then
      begin
        mem1.Lines.Add('Waiting for authorization token...');
      end
    else
      begin
        mem1.Lines.Add('Error while get authorization token: ' + rest.LastError);
      end;
    end;
    
    procedure TForm1.SetupOAuth;
    begin
      rest.DebugLevel    := DebugSsl;
      rest.ProtoType     := OAuthv2;
      rest.AuthType      := OAuthTypeWeb;
      rest.AppUrl        := sAuthURL;
      rest.ClientId      := Trim(sClientID);
      rest.RedirectUrl   := Trim(sRedirectURI);
      rest.ClientSecret  := Trim(sSecretKey);
      rest.RedirectUrl   := Trim(sRedirectURI);
      rest.Scope         := sScopeList;
      rest.OAOptions     := [];
      rest.RefreshAuto   := True;
      rest.WebSrvIP      := sLocalAddr;
      rest.WebSrvPort    := sLocalPort;
      rest.TokenUrl      := sTokenURL;
    end;

    When  I run my app and step by break-points I see what event "OnRestRequestDone" never rise. Is it ok?


  2. OK. I'm watched in "OverbyteIcsHttpRestTst" and try to reproduce these code. But  always get message: "Failed to Generate App Token

    App Authorization Code: blah-blah-blah". Where I can see what I'm doing wrong?

    My code:

    const
      sAuthURL            = 'https://login.eveonline.com/v2/oauth/authorize/';
      sRedirectURI        = 'http://localhost:5561/';
        sSecretKey        = '...';
     sTokenURL            = 'https://login.eveonline.com/oauth/token';
        sClientID         = '...';
        sScopeList        = 'esi-location.read_location.v1';
        sLocalAddr        = '127.0.0.1';
        sLocalPort        = '5561';
    	sTokenURL     = 'https://login.eveonline.com/oauth/token';
    
    
    procedure TForm1.imgLoginClick(Sender: TObject);
    var
      url: string;
      sb: TStringBuilder;
      code: string;
    begin
      mem1.Lines.Clear;
      SetupOAuth;
      if rest.StartAuthorization then
      begin
        mem1.Lines.Add('Waiting for authorization token...');
      end
    else
      begin
        mem1.Lines.Add('Error while get authorization token: ' + rest.LastError);
      end;
    end;
    
    procedure TForm1.SetupOAuth;
    begin
      rest.DebugLevel    := DebugSsl;
      rest.ProtoType     := OAuthv2;
      rest.AuthType      := OAuthTypeWeb;
      rest.AppUrl        := sAuthURL;
      rest.ClientId      := Trim(sClientID);
      rest.RedirectUrl   := Trim(sRedirectURI);
      rest.ClientSecret  := Trim(sSecretKey);
      rest.RedirectUrl   := Trim(sRedirectURI);
      rest.Scope         := sScopeList;
      rest.OAOptions     := [];
      rest.RefreshAuto   := True;
      rest.WebSrvIP      := sLocalAddr;
      rest.WebSrvPort    := sLocalPort;
      rest.TokenUrl      := sTokenURL;
    end;

    When I Set this parameters in demo all ok, but not work in my app

×