The information in this thread might be outdated
If the solution did not help, please, check our Help Portal or contact Ecwid Team.
 
 
Thread Tools Display Modes
  #1  
Old 06-29-2015, 10:09 PM
MediaMastery's Avatar
MediaMastery is offline
 
Join Date: Jun 2015
Posts: 1
Default

Problem getting token with OAuth?


Hi, I can't get it to work to get the access token when logging in with OAuth? I have used similar OAuth before with other services, but now it always returning error? unfortunately I can't see the error as the status is 0.

It works to request the code, but this call doesn't get me the access token?

$http.post('https://my.ecwid.com/api/oauth/token', {
client_id: Ecwid.client_id,
client_secret: Ecwid.client_secret,
code: code,
redirect_uri: Ecwid.redirect_uri,
grant_type: 'authorization_code'
}).
success(function(data, status) {
console.log(data.access_token);
}).
error(function(data, status) {
console.log(status);
});


The client_id, client_secret etc are correct, is there some header I need to send?
  #2  
Old 07-01-2015, 03:12 PM
Rick G's Avatar
Rick G Rick G is offline
Ecwid Team
 
Join Date: Jun 2014
Posts: 1,271
Default

Quote:
Originally Posted by MediaMastery View Post
Hi, I can't get it to work to get the access token when logging in with OAuth? I have used similar OAuth before with other services, but now it always returning error? unfortunately I can't see the error as the status is 0.

It works to request the code, but this call doesn't get me the access token?

$http.post('https://my.ecwid.com/api/oauth/token', {
client_id: Ecwid.client_id,
client_secret: Ecwid.client_secret,
code: code,
redirect_uri: Ecwid.redirect_uri,
grant_type: 'authorization_code'
}).
success(function(data, status) {
console.log(data.access_token);
}).
error(function(data, status) {
console.log(status);
});


The client_id, client_secret etc are correct, is there some header I need to send?
Hi,

Thank you for contacting us.

As I can see, you have registered an application for Ecwid that is installed on a device.

The process of retrieving access token for Ecwid store in your application differs from the similar process for web applications.

So on the second step of this procedure: http://developers.ecwid.com/api-docu...t-access-token the temporary code is provided by Ecwid on a blank page in the <title> tags. Here's how it can look:
Code:
<title>oauth_response:code=54xgQHmbZrrLTqzCiHPyw&amp;state=code</title>
So in order to get access token, you will need to parse that temporary code and then use it later on in the step 3, when you will request the token itself using a POST method.

For more information on how to retrieve the token for applications that use Ecwid API, please refer to this section of our documentation: http://developers.ecwid.com/api-docu...d-applications

Thank you.
__________________
Ecwid API and App Market Team
Ecwid Developer Website

Last edited by Vitaliy G; 01-04-2016 at 12:18 PM.
 
The information in this thread might be outdated
If the solution did not help, please, check our Help Portal or contact Ecwid Team.

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:08 AM.
Powered by vBulletin® Version 3.8.11. Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.