2014-04-14 9:49 GMT-03:00 Michael Van Canneyt <mich...@freepascal.org>: > > On Mon, 14 Apr 2014, silvioprog wrote: > >> Hello, >> Just a question, anyone here has implemented some code for OAuth 2.0? >> (FPC or Delphi) >> >> I implemented with 1.0 in my new TDropbox class, but now I'm trying to >> implement it with 2.0, because I'm needing to make an >> automatic authorization in a server side app. >> >> So, if you prefer no need to show me code, I'm just wondering if anyone >> has tried and already succeeded. >> > > It is on my agenda. I was planning to add the OAuth 1.0 implementation of > Reinier to fcl-web, > then look at OAuth 2.0. I will be needing it myself. > > Michael.
Very nice. For 1.0 was easy, because I found a base code in PHP: class function TDropboxOAuthUtil.GenerateAuthorizationContent( const AAppKey: string): string; begin Result := 'oauth_consumer_key=' + AAppKey + '&oauth_nonce=' + GenerateNonce + '&oauth_signature_method=HMAC-SHA1' + '&oauth_timestamp=' + GenerateTimeStamp + '&oauth_version=1.0'; end; class function TDropboxOAuthUtil.GenerateAuthorizationUrl(const AAppKey, AAppSecret: string): string; var VSignature: string; begin Result := GenerateAuthorizationContent(AAppKey); VSignature := 'POST&' + EncodeUrl(API_URL + '/oauth/request_token') + '&' + EncodeUrl(Result); Result := API_URL + '/oauth/request_token?' + Result; VSignature := EncodeBase64(HMAC_SHA1(VSignature, AAppSecret + '&')); Result := Result + '&oauth_signature=' + EncodeUrl(VSignature); end; Now I'm trying with 2.0, if it work, I'll send you all my drafts. -- Silvio Clécio My public projects - github.com/silvioprog
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal