Currently Reading

Image of Derivatives Demystified: A Step-by-Step Guide to Forwards, Futures, Swaps and Options (The Wiley Finance Series)

Image of Working Effectively with Legacy Code (Robert C Martin)

Image of Coders at Work: Reflections on the Craft of Programming

Image of Succeeding with Agile: Software Development Using Scrum (Addison-Wesley Signature)

Recently Read

Image of Test Driven Development (The Addison-Wesley Signature Series)

Image of The Secrets of Consulting: A Guide to Giving and Getting Advice Successfully

Image of iPhone Advanced Projects (Books for Professionals by Professionals)

Image of Advanced Actionscript 3 with Design Patterns

Image of Refactoring: Improving the Design of Existing Code (Object Technology Series)

Image of Test Driven: TDD and Acceptance TDD for Java Developers

Image of Clean Code: A Handbook of Agile Software Craftsmanship (Robert C. Martin)

Image of Beginning iPhone 3 Development: Exploring the iPhone SDK

Image of Cloud Atlas

Image of UML 2 for Dummies


March 5, 2009

Salesforce ActionScript Fun

Filed under: ActionScript, Bug Fixes, Flex — Anthony @ 4:41 pm

Ok I have been working with the salesforce API for a couple of days now and I have found it very interesting. However I have found a few things that don't seem to be very clear when trying to simply login to your account from an application that is running outside of the salesforce Sandbox.
So as i have seen a lot of posts about this i have decided to explain how i go about logging in here.

1. To login you need 3 things
1. Username in the form user@user.com
2. Password.
3. Security Token
To get the security token for a user go to setup>Reset your security token. This will then be emailed to you.

Logging into an Administrators account seems to be different than logging into a normal users account.
For Administrators you have to set the protocol to 'http' for normal users set it to 'https' in addition we have to add the token to the password as follows.

 
private var _conn : Connection = new Connection( );
 
private function login( username : String, password : String,
           token : String, isAdmin : Boolean = false ) : void
{
    _connection.protocol = isAdmin ? 'http' : 'https';
    var login : LoginRequest = new LoginRequest( );
	  login.username = value..username;
	  login.password = value..password.toString( )
                                    + value..token.toString( );
	  login.callback = new Responder( loginResult, loginFault );
	 _connection.login( login );
}
 

No Comments »

No comments yet.

RSS feed for comments on this post. | TrackBack URI

Leave a comment

XHTML ( You can use these tags): <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .