alfdev / linkedin-j

Automatically exported from code.google.com/p/linkedin-j
0 stars 0 forks source link

opt contains illegal character value '-' #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Tried with the OAuthAuthenticationExample.java

specified the consumer key and secret option, but the error appears:

Exception in thread "main" java.lang.IllegalArgumentException: opt contains
illegal character value '-'
    at
org.apache.commons.cli.OptionValidator.validateOption(OptionValidator.java:73)
    at org.apache.commons.cli.Option.<init>(Option.java:123)
    at org.apache.commons.cli.Option.<init>(Option.java:90)
    at org.apache.commons.cli.OptionBuilder.create(OptionBuilder.java:351)
    at
com.google.code.linkedinapi.client.examples.OAuthAuthenticationExample.buildOpti
ons(OAuthAuthenticationExample.java:126)
    at
com.google.code.linkedinapi.client.examples.OAuthAuthenticationExample.main(OAut
hAuthenticationExample.java:51)

due to the OptionValidator class

there are a couple of '-' in the key and secret option

How do i counter this problem??

Any help is welcome.

Original issue reported on code.google.com by avisa...@gmail.com on 11 Dec 2009 at 12:26

GoogleCodeExporter commented 9 years ago
The syntax to execute the example is: (replace your own consumer key and secret 
and
make sure all the required jars are in classpath)

java com.google.code.linkedinapi.client.examples.OAuthAuthenticationExample
-consumerKey TdA4ZuoRgD46-vh8kFF9l0xcs5W3ODBaGdto1OdLv9ujfZiKpq4_KBfT7j-xxxxx
-consumerSecret biSbgqH0hSzCvDMDsQyA21AOapiLzUS8Ka11QDraqVGj8kFZJEY1FrqUqYdxxxx

Both the consumer key and secret can contain underscores and dashes. If you 
still
cannot execute the example, please specify the commandline syntax you are using 
to
execute it.

Thanks for your help.

Regards
Nabeel Mukhtar

Original comment by nabeelmukhtar on 11 Dec 2009 at 12:54

GoogleCodeExporter commented 9 years ago
well i have changed the CONSUMER_KEY_OPTION and the CONSUMER_SECRET_OPTION in 
the
OAuthAuthenticationExample and both my key option and secret option contain '-' 
which
is not being accepted. i have included all the jar specially the commons.cli 
which
contions the options package.

i am running it from eclipse.

do u think it's some encoding problem and needs some http encoding????

Original comment by avisa...@gmail.com on 14 Dec 2009 at 6:10

GoogleCodeExporter commented 9 years ago
You do not have to change the source file. You have to specify consumer key and
secret in the command line.
The CONSUMER_KEY_OPTION and CONSUMER_SECRET_OPTION are the command line option 
names
and not the key and secret so changing them will break the example.
So do not change the source file and in eclipse specify the program arguments 
as:
-consumerKey TdA4ZuoRgD46-vh8kFF9l0xcs5W3ODBaGdto1OdLv9ujfZiKpq4_KBfT7j-xxxxx
-consumerSecret biSbgqH0hSzCvDMDsQyA21AOapiLzUS8Ka11QDraqVGj8kFZJEY1FrqUqYdxxxx

Then run the example.

Hope that helps.

Regards
Nabeel Mukhtar

Original comment by nabeelmukhtar on 14 Dec 2009 at 11:57

GoogleCodeExporter commented 9 years ago
Well i haven't made any changes to the source file, tried out the signpost outh
source code. was able to make a call. i think its an encoding issue, signpost is
using the HMAC_SHA1 standard for linkedin. If i find time i'l try it out myself.

Regards
Avijit Sadhu

Original comment by avisa...@gmail.com on 15 Dec 2009 at 5:17

GoogleCodeExporter commented 9 years ago

Original comment by nabeelmukhtar on 17 Dec 2009 at 7:31