are you sure your encode method is correctly base64-encoding the
credentials?

On Tue, Aug 18, 2009 at 08:18, havis <bazoa...@gmail.com> wrote:

>
> Hello Adam, actually i am using basic authentication sending login and
> password as a header request:
>
>                            String url = "http://twitter.com/statuses/
> friends_timeline.xml <http://twitter.com/statuses/%0Afriends_timeline.xml>
> ";
>                            String credentials = "username:password";
>                            credentials = encode(credentials); // this
> method encode
> the login and password as base64
>                            HttpConnection con =
> (HttpConnection)Connector.open
> (url);
>                            con.setRequestProperty("Authorization", "Basic "
> +
> credentials);
>                            con.setRequestMethod("GET");
>                            con = (HttpConnection)Connector.open(url);
>                            InputStream is1 = con.openInputStream();
>                            showReply(con, is1); // This method displays in
> the
> screen the reply from twitter that i have showed before.
>                            is1.close();
>
> This source code is j2me, i have implemented a similar code in java
> and it works fine, no authentication problem but when i use the code
> above, there is always the authentication problem message. Any idea?
> thanks.
>
> On 17 ago, 22:46, Adam Shannon <a...@ashannon.us> wrote:
> > On Mon, Aug 17, 2009 at 9:42 PM, havis <bazoa...@gmail.com> wrote:
> >
> > > Hello, i am working on a project for mobile phones and Twitter API. I
> > > made tests using java platform and everything works ok, when i use the
> > > same credentials in j2me, there is always the following message as
> > > response:
> >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <hash>
> > >  <request>/statuses/friends_timeline.xml</request>
> > >  <error>Could not authenticate you.</error>
> > > </hash>
> >
> > > I am using basic authentication. Did you have this problem? Can
> > > anybody help me please? thanks in advance.
> >
> > Are you using this basic format?
> > http[s]://username:passw...@twitter.com/authenticate/
> >
> > --
> > - Adam Shannon (http://ashannon.us)
>



-- 
Internets. Serious business.

Reply via email to