function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ToddKruseToddKruse 

using Flex Development Application to test out a flex component error when logging in

Here is the code I am using in my swf file.  I am clicking the "debug" button.  The error message is after the code.  The username/password I am using (not what you are seeing) is what I use to log into one of our sandboxes as if I was a user logging into salesforce.  Any help would be greatly appreciated.

 

Thanks

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application creationComplete="login(event)" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:salesforce="http://www.salesforce.com/">

<salesforce:Connection id="apex" serverUrl="https://www.salesforce.com/services/Soap/u/9.0" />

 

<mx:Script>

<![CDATA[

import mx.collections.ArrayCollection;

import com.salesforce.results.QueryResult;

import mx.utils.ObjectUtil;

import mx.controls.Alert;

import com.salesforce.AsyncResponder;

import com.salesforce.objects.LoginRequest;

private function login(event:Event):void {

var lr:LoginRequest = new LoginRequest();

lr.username = "xxxxxx";

lr.password = "xxx";

lr.callback = new AsyncResponder(loadData, handleFault);

apex.login(lr);

}

 

[Bindable]

private var accountList:ArrayCollection = new ArrayCollection();

private function handleFault(fault:Object):void {

Alert.show(ObjectUtil.toString(fault));

}

private function loadData(lr:Object):void {

apex.query("Select Name, Phone, Type From Account", new AsyncResponder(

function(qr:QueryResult):void {

if (qr.size > 0) {

accountList = qr.records;

}

}, 

handleFault)

);

}

]]>

</mx:Script>

<mx:DataGrid dataProvider="{accountList}" left="10" right="10" top="10" bottom="10">

<mx:columns>

<mx:DataGridColumn dataField="Name"/>

<mx:DataGridColumn dataField="Phone"/>

<mx:DataGridColumn dataField="Type"/>

</mx:columns>

</mx:DataGrid>

</mx:Application>

 

here is the error message:

 

 (com.salesforce.results::Fault)#0

  context = (null)

  detail = (Object)#1

    LoginFault = (Object)#2

      exceptionCode = "INVALID_LOGIN"

      exceptionMessage = "Invalid username, password, security token; or user locked out."

      xsi:type = "sf:LoginFault"

  faultcode = "INVALID_LOGIN"

  faultstring = "INVALID_LOGIN: Invalid username, password, security token; or user locked out."

Andy Freeston_LarterAndy Freeston_Larter

Did you remember to pass in the security token as well as the password?

 

The password would be set something like this:

lr.password = "myPassword" + "aksjhdhef982fyu3hfaa";

ToddKruseToddKruse

Thanks for the update.  I was not aware of a token.  I asked our sys admin and he said he didn't create one when he created the user account.

 

Where would I find this info?

 

Thanks

 

--Todd Kruse 

Andy Freeston_LarterAndy Freeston_Larter

From Salesforce, click the Setup link.

Expand My Personal Information and click Reset My Security Token.

Click Reset Security Token and you should get the token my e-mail. You will get sent a new one whenever you change your password.

 

You can avoid using the password and token by dropping the flash into a visualforce page and just using the existing authenticated connection.

ToddKruseToddKruse

so I went to the area of salesforce you were talking about.  There is no option to Reset my security token.

 

Does this have something to do with how this account is set up that you wouldn't get that option?

 

 

Thanks

 

--Todd Kruse

 

Andy Freeston_LarterAndy Freeston_Larter

Sorry, I don't know.

 

It might be the SF edition you are using or perhaps the account type. You might want to raise a case with SFDC support.