Home » Developers » Shapeways API » Oauth question
Search Search  
Show: Today's Messages    Show Polls    Message Navigator
Oauth question [message #68518] Wed, 22 May 2013 22:36 UTC Go to next message
avatar timcastelijn  is currently offline timcastelijn
Messages: 4
Registered: March 2012
Go to my shop
Junior Member
Hi Everyone,

I want to login to my account to make a browser based modeling tool and uploader. I have some trouble though getting an acces token.

if i fill in my credentials in the consumer_key.php, I can:

1. open <mypage>//php-curl/AuthorizeWithRequestUriQuery-oauth1-curl.php see file here

2. i get the following reply:
Quote:

[..]Received a temporary request token : Request token : 75406c2b982364998f8a5fad61c5f14255c49a0e Request token secret : 5370ace36d71227d32f03721c9a0f6646a2d5067 Next please authenticate yourself at http://api.shapeways.com/login?oauth_token=75406c2b982364998 f8a5fad61c5f14255c49a0e and collect the PIN for the next step. Fatal error: Call to undefined function readline() in /customers/1/7/f/timcastelijn.nl/httpd.www/savetoweb/2013052 2/php-curl/AuthorizeWithRequestUriQuery-oauth1-curl.php on line 92


3. i can now go to
http://api.shapeways.com/login?oauth_token=75406c2b982364998 f8a5fad61c5f14255c49a0e
where after I log in i get a verification code

What do I do with this verification code to proceed?

4. if I enter it in the AuthorizeWithRequestUriQuery-oauth1-curl.php as $pin I get in return
Quote:

Acces token: Acces token secret:
(i.e. null values).

5. another try was to authenticate with <mypage>php-pecl/Authorize-oauth1-pecl.php, but then i immediatley get
Quote:

Fatal error: Class 'Oauth' not found in <mypage>php-pecl/Authorize-oauth1-pecl.php on line 11



Can anyone help me with this?

best regards,
Tim



Re: Oauth question [message #69171 is a reply to message #68518 ] Tue, 04 June 2013 15:04 UTC Go to previous messageGo to next message
avatar ProfessorBeekums  is currently offline ProfessorBeekums
Messages: 35
Registered: February 2013
Go to my shop
Member
I work here
Hi Tim,

The error you're seeing with AuthorizeWithRequestUriQuery-oauth1-curl.php is because that file is prompting for input from the command line. If you provide it no input, it can't continue. The input should be the PIN you receive.

The oauth error is because you don't have the oauth package installed. From the installation instructions here: https://github.com/Shapeways/shapeways-api/tree/master/php-p ecl you need to run 'pecl install oauth'

Hope that helps,
Beekey
Re: Oauth question [message #70486 is a reply to message #69171 ] Tue, 25 June 2013 16:28 UTC Go to previous messageGo to next message
avatar timcastelijn  is currently offline timcastelijn
Messages: 4
Registered: March 2012
Go to my shop
Junior Member
thanks for your help so far. II installed the Oauth module. I have some further questions though:

1. if I open /shapeways/php-pecl/Authorize-oauth1-pecl.php in my browser I get to the readline point as well however in if I enter
php Authorize-oauth1-pecl.php

in the cli I still get the "Oauth class not found" error. Does this mean it does find the class when I execute the script using the browser and but can't find it when using the cli?

2. If I go to follow the link that the script returns I get a verifier code after login. Does this mean I authorize my own account to be accesed by the scripts that use the authentication token? is this a one time authorisation?

3. Can the pin only be put in using CLI?

best regards,
Tim




Re: Oauth question [message #70494 is a reply to message #70486 ] Tue, 25 June 2013 18:03 UTC Go to previous messageGo to next message
avatar ProfessorBeekums  is currently offline ProfessorBeekums
Messages: 35
Registered: February 2013
Go to my shop
Member
I work here
1) CLI PHP and Apache PHP use different configurations. You have to make sure the oauth module is included in both.

2) Yes, oauth authenticates a single user for your app per token: http://developers.shapeways.com/getting-started?li=dh_gs#aut henticate Tokens do not expire at the moment so you can use one perpetually.

3) Yes. Our reference clients are meant to serve as an example. You are free to use as much or as little of the code as you need to develop your own application.
Re: Oauth question [message #85010 is a reply to message #70494 ] Mon, 17 February 2014 20:55 UTC Go to previous messageGo to next message
avatar samynotsure  is currently offline samynotsure
Messages: 1
Registered: February 2014
Go to all my models
Junior Member
how is it possible to avoid the user typing the "PIN"?
Thanks
Re: Oauth question [message #85056 is a reply to message #85010 ] Tue, 18 February 2014 22:35 UTC Go to previous messageGo to next message
avatar ProfessorBeekums  is currently offline ProfessorBeekums
Messages: 35
Registered: February 2013
Go to my shop
Member
I work here
The default callback in our PHP example is 'oob'. If this is passed, the user will be directed to a site with a PIN which they will need to copy/paste somewhere.

If you provide a different callback url, Shapeways will call that url with the PIN for you to automatically process so that the user doesn't need to type anything.
Re: Oauth question [message #96050 is a reply to message #85056 ] Wed, 13 August 2014 14:04 UTC Go to previous messageGo to next message
avatar minichua  is currently offline minichua
Messages: 10
Registered: November 2013
Go to my shop
Junior Member
Hello,

the Oauth method is really not clear to me.

Question 1:
- to simply upload a model , do we have to go through the whole authentification method and then use the POST request or can we use the POST directly?
Question 2:
- Can you give an explicit example on how to automatically callback with the PIN so that the user does not need to do anything?
Question 3:
- oauth, readline, consumer keys are installed on CentOS. I can not make any script work. It seems none can pass the $oauth_client = new Oauth(...) line. Do you have any tips on that? I am running CentOS 6.5.

Sincerely.

[Updated on: Wed, 13 August 2014 15:48 UTC]

Re: Oauth question [message #96245 is a reply to message #96050 ] Fri, 15 August 2014 11:25 UTC Go to previous message
avatar minichua  is currently offline minichua
Messages: 10
Registered: November 2013
Go to my shop
Junior Member
Problem solved

 
   
Previous Topic:MARKUP
Next Topic:Can not Authenticate with API

Logo

Hello.

We're sorry to inform you that we no longer support this browser and can't confirm that everything will work as expected. For the best Shapeways experience, please use one of the following browsers:

Click anywhere outside this window to continue.