- Home
- Technical Library
- Boards
- Cookbook
- Code Share
- Blogs
- Partners
-
More
-
Services
- Training & Certification
- Support
-
Galleries
- Force.com Sites Gallery
- Chatter Challenge Entries
-
Other Web Sites
- Salesforce.com
- Database.com
- AppExchange
- CRM Community
-
Discussions
- Announcements
- General Development
- Schema Development
- New to Cloud Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules Discussion
- Security
- Mobile
- Force.com Sites
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby Development
- Adobe Flash Builder for Force.com
- Desktop Integration
- REST API Integration
- Streaming API
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- Excel Connector
- AJAX Toolkit & S-controls
- Force.com Builder & Native Apps
- AppExchange Directory & Packaging
- Force.com Labs Projects
- Open Source
- Site.com
- Jobs Board - Administrators
- Jobs Board - Developers
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Apex Code Development
- :
- OAuth 1.0 Signature
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
OAuth 1.0 Signature
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-24-2012 12:45 PM - last edited on 02-24-2012 12:55 PM
Hi everybody,
I'm having some troubles with OAuth 1.0
Here i got some data.
requst token url - 'https://api.demo.com/requestToken'
consumer key like - 'demoHelloWorld'
consumer secret like - 'demoHelloWorldSecret'
signature method is - 'HMAC-SHA1'
some nonce like - 'GpNODMzhMP0'
and timestamp like - '1330114249'
all i'm doing is sending POST request to request token URL with header called 'Authorization' and
OAuth oauth_nonce="GpNODMzhMP0", oauth_signature_method="HMAC-SHA1", oauth_signature="r6LRsHFDqNu05oLaxSGn/dXZpIo=", oauth_timestamp="1330114249", oauth_consumer_key="demoHelloWorld", oauth_version="1.0"
in it.
Status code of response is 401 - Unauthorized .
From OAuth docs i found that this means one or more of this points: "Invalid Consumer Key Invalid / expired Token Invalid signature Invalid / used nonce"
I suppose that the issue is in generating correct signature.
Can somebody describe how should i do this?
Here how i do this :
Blob hash = Crypto.generateMac('hmacSHA1',Blob.valueOf(myData) ,Blob.valueOf(consumer_key));
String signature= EncodingUtil.urlEncode(EncodingUtil.base64Encode(h ash), 'UTF-8');
'myData' is string generated from Request type, URL and params for this example it will look like
'POST&https%3A%2F%2Fapi.demo.com%2FrequestToken&oauth_consumer_key%3DdemoHelloWorld%26oauth_nonce%3D GpNODMzhMP0%26oauth_signature_method%3DHMAC-SHA1%2 6oauth_timestamp%3D1330114249%26oauth_version%3D1. 0'
If more information is needed please ask.
I will appreciate any help.
Thanks
Re: OAuth 1.0 Signature
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-27-2012 02:08 AM
Hi,
Please go through the link below:
http://code.google.com/apis/accounts/docs/OAuth_re
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Navatar Group

