amzn / selling-partner-api-models

This repository contains OpenAPI models for developers to use when developing software to call Selling Partner APIs.
Apache License 2.0
580 stars 730 forks source link

InvalidInput: 'Developer ID 5xxxxxxxxxxxx0 is not associated with the application id.' #805

Closed intellifox-hq closed 3 years ago

intellifox-hq commented 3 years ago

I'm trying to migrate my users from MWS to SP-API using GET /authorization/v1/authorizationCode

I'm getting the following error:

{
  errors: [
    {
      code: 'InvalidInput',
      message: 'Developer ID 5xxxxxxxxxxxx0 is not associated with the application id.',
      details: ''
    }
  ]
}

Here is the complete code I'm using. It works perfectly for self authorized operations (I'm able to list my own orders for instance).

const convert_mws_token_to_auth_token = async ({ mws_auth_token, selling_partner_id, developer_id }) => {
  try {
    const lwa_response = await axios.post('https://api.amazon.com/auth/o2/token', {
      grant_type: 'client_credentials',//   The type of access grant requested. Must be authorization_code.
      scope: 'sellingpartnerapi::migration',

      client_id,//  Part of your LWA credentials. To get this value, see Viewing your developer information.
      client_secret,//  Part of your LWA credentials. To get this value, see Viewing your developer information.
    })

    const grantless_token = lwa_response.data.access_token

    const endpoint = 'sellingpartnerapi-eu.amazon.com'
    const region = 'eu-west-1'

    // const endpoint = 'sellingpartnerapi-na.amazon.com'
    // const region = 'us-east-1'

    const HTTP_method = 'GET'
    const path = '/authorization/v1/authorizationCode'
    const query_string = `sellingPartnerId=${selling_partner_id}&mwsAuthToken=${mws_auth_token}&developerId=${developer_id}`
    const service = 'execute-api'

    const now = new Date()

    const headers_to_sign = {
      host: endpoint,
      'x-amz-access-token': grantless_token,
      'x-amz-date': `${moment(now).toISOString()}`,
      'user-agent': 'intellifox-api-1.6',
    }

    const canonical_request = createCanonicalRequest(
      HTTP_method, path, query_string, headers_to_sign,
    )

    const string_to_sign = createStringToSign(
      now, region, service, canonical_request,
    )

    const signature = createSignature(
      secret, now, region, service, string_to_sign,
    )

    const sp_api_response = await axios({
      method: HTTP_method,
      url: `https://${endpoint}${path}?${query_string}`,
      headers: {
        Authorization: `AWS4-HMAC-SHA256 Credential=${key_id}/${moment(now).format('YYYYMMDD')}/${region}/${service}/aws4_request, SignedHeaders=host;user-agent;x-amz-access-token;x-amz-date, Signature=${signature}`,

        'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
        ...headers_to_sign,
      },
    })

    console.log('ok', sp_api_response.data)
  } catch (e) {
    console.log(e.response.data)
    /*
      {
        errors: [
          {
            code: 'InvalidInput',
            message: 'Developer ID {developer_id} is not associated with the application id.',
            details: ''
          }
        ]
      }
     */
  }
}

Am I missing something?

I opened a case ( case id is 6552816932 ) but I'm posting this issue here in the hope I can solve it on my side.

Thanks for any help.

intellifox-hq commented 3 years ago

Same as amzn/selling-partner-api-models#798 apparently.

gasper-vrhovsek commented 3 years ago

Hi @intellifox-hq ,

yes, we have the same issue. Sadly i haven't managed make any more progress regarding this. I'll let you know if we do.

Best, Gasper

intellifox-hq commented 3 years ago

@parvathm Thank you for the label. What is the best course of action for this issue to be resolved?

I promised my clients I would eat my microphone if I didn't deliver this feature by December the 1st of 2020. True story. I need your help.

gasper-vrhovsek commented 3 years ago

@intellifox-hq have you managed to fix this issue?

We went with the new LWA registration flow with the help of this PHP project and it's working for us. We will have to ask our existing selling partners to re-authorize us, but we're willing to do that. We had to get the application approved and published with the Oauth url fields filled in to get the LWA authentication working though (before approval only the self-authorization worked).

Let me know if i can help you somehow.

intellifox-hq commented 3 years ago

Hello @gasper-vrhovsek !

Since yesterday, I received an approval message from Amazon stating that my app is now published.

Unfortunately, I'm still experiencing the same issue.

Moreover when I use the proper LWA link for the workflow, it still show the old style form: https://sellercentral.amazon.co.uk/apps/authorize/consent?application_id=amzn1.sellerapps.app.0c27b067-aad0-45cd-be7e-09e380589bb8&state=hello_there

I would be glad to ask my customers to re-authorize us but:

  1. That's not possible because my link doesn't show the new LWA workflow
  2. There is a specific API to gain authorization from previous MWS authorization and I'd much rather use this than ask any action :-p This should work!

Maybe I need to wait a little bit before my LWA link starts working properly and that my code doesn't produce the initial error. Patience is a virtue

Thank you very much anyway for your concern and solidarity. What are you working on exactly?

gasper-vrhovsek commented 3 years ago

Hi @intellifox-hq

Is your application only approved, but not still published maybe? That's the state our app was for a day or two. In that time we also got the old authorization form when opening the /authorize/consent link in sellercentral. After the app was completely published, is when we got to the new LWA form.

We decided to first support the new LWA flow and support the hybrid approach after we did that successfully.

I'm working on this app

intellifox-hq commented 3 years ago

Hello @gasper-vrhovsek

Thank you for your help, I really appreciate it. In the status column, it's written

Published Current edit is approved and pending publishing

So I guess I must wait for the actual publishing to take place. Thank you :+1:

Well done, I'll probably do the same. Right now I know my onboarding workflow will stop working quite soon and I'll have to fix it right away.

I see you're a big team :) Nice to chat with you any time

gasper-vrhovsek commented 3 years ago

Hello @intellifox-hq

Yes, this was the state of our app for a day or two also. After it was published the LWA started working.

I am glad to help, as i was also a bit frustrated working with this api and LWA. I hope you manage to resolve all your issues. If you have any further problems don't hesitate to contact me.

Best regards, G

petergzli commented 3 years ago

Hey @intellifox-hq thanks for sharing your insights. Did this new consent step finally work for you? I have been officially published as of today after about 5 days in the pending state. However, I am still receiving the old form asking me for the developer ID; however, I registered with the new SP-API in mind and was not assigned a developer ID nor do I think it's the right flow as we are expecting the standard consent step as seen when we appended version=beta. As of now, none of my sellers can authorize my new application.

Thanks @gasper-vrhovsek for all your contributions to these threads by the way, we appreciate you.

intellifox-hq commented 3 years ago

Hey @petergzli ! Welcome to the club.

My app is now fully "Published" and ... I still get the old-style form. My problem is nowhere near solved.

I reached the MWS support, they told me to activate "Enable OAuth from Appstore" (which I don't want - but I did it anyway for the sake of it - it has been a week now). This action did not solve my issue. I'm now waiting for an answer.

In your case it seems like you never should see the old form... I suspect this may have something to do with the fact that my account is EU-based or something. Are you in the EU or somewhere else? Any way, open a case there: https://sellercentral.amazon.co.uk/gp/mws/contactus.html (change the ".co.uk" extension if you are not in the EU) and hopefully they will be able to solve it.

ibrahimzahoor commented 3 years ago

Hey @intellifox-hq and @gasper-vrhovsek!

I'm also facing the same issue I have been following this issue for updates.

As @gasper-vrhovsek said

Yes, this was the state of our app for a day or two also. After it was published the LWA started working.

I thought it would work fine after a couple of days but it's in the same condition. I have not yet enabled the option Enable OAuth from Appstore

If I change anything like OAuth login/redirect URL it again goes into preview and I have to wait for a couple of days. I'm working for different clients so the condition is the same for an app registered in US and EU region. One app is purely SP-API and the second one is SP & MWS.

If anyone got this issue resolved also please let us know here so we can follow the same steps.

PS: Amazon support team is not helping with the case on seller central, it's in open status for weeks.

intellifox-hq commented 3 years ago

Still no solution from MWS support team. I opened another issue on the MWS contact us form in hope of reaching a solution https://sellercentral.amazon.co.uk/gp/mws/contactus.html

I'm really looking forward to a solution to this issue.

@parvathm Could you give us some insight into why this kind of support request is taking so long? Thank you very much. CaseID is 6679488172

intellifox-hq commented 3 years ago

This issue is now SOLVED! :+1: :+1: :+1:

I didn't change anything in my code; there was an issue in some configuration on Amazon end.

This is the explanation I had from @parvathm

Can you please try the request now? We have update a configuration now looks like it was missed when publishing the application.

BUT I'm still having an issue with the consent form. The old consent form is displayed. I hoped that the two issues were related and solving one would solve the other ; but right now it is not the case. I didn't close the 6679488172 Case on MWS support in order to solve this last issue :+1:

Anyway, thank you @parvathm !

petergzli commented 3 years ago

Hey @intellifox-hq @parvathm thanks for keeping everyone posted. I am still getting the old consent form as well. I can't even input the developer ID since I had registered for the SP-API exclusively and was never assigned a MWS developer ID, in which case this doesn't even work.

I noticed my "Enable OAuth from Appstore" was unchecked. So I went ahead and enabled it which didn't change anything. I also re-submitted that change for re-approval in case that checkbox needed to be processed through Amazon. But mine is currently still

Published Current edit is approved and pending publishing

intellifox-hq commented 3 years ago

I can't even input the developer ID since I had registered for the SP-API exclusively and was never assigned a MWS developer ID, in which case this doesn't even work.

That definitively sucks. Usually it's not good practice, but here is an advice I often give to my users (all of whom are sellers on Amazon) "If your case is not solved with the answer you get, weirdly enough, just close it and open it again. Repeat until success. At some point, someone with their eyes open who really cares will take the time and be able to solve the issue."

petergzli commented 3 years ago

@intellifox-hq I just reopened the case Thanks for that advice. Let's see what happens. Just curious has anyone approved by amazon seen the new consent form in production?!

intellifox-hq commented 3 years ago

I just had an answer from the MWS support team (this case was opened on December 19th 2020!)

Hello Conrad,

My name is Carolina, from the Developer Support team, I apologize for the long wait.

I was reviewing the case and the status for the application id amzn1.sellerapps.app.0c...b8, and I am able to confirm that publishing was completed on Jan 06. However, the main reason why is not displaying correctly is because in the publishing steps the OAuth was disable.

I will recommend to edit the application to enable the OAuth from AppStore, for the already published application. By doing this should be changed to the current SP API version.

If you do not want to publish the application in our AppStore, then you will need to keep the application in Draft status using ‘version=beta’ parameter in the OAuth URL.

Please let me know if you have follow up questions.

I appreciate your understanding.

Regards,

C***** A. Amazon.co.uk Seller Support

I'm intrigued.

The solution according to her would be to republish the app with the "Enable the OAuth from AppStore" (which I don't want, but what the heck!). I'll try that.

BUT I'm quite intrigued as well with the whole "You can keep using version=beta" in the URL. If that works I'm baffled to what this "beta" state actually means. If it gives the real refresh token and everything then I'm golden.

Hope this can help you as well @petergzli

And to answer your question: I'm pretty sure that the big players of this space fixed this a while ago. I don't have a proof though!

intellifox-hq commented 3 years ago

This didn't solve my issue: with "version=beta", I don't receive the mwsAuthToken that I still need for obvious legacy reasons. Ugh.

petergzli commented 3 years ago

Hi @intellifox-hq thanks for the quick responses. Okay, looks like I am waiting to test this theory. I checked that "Enable the OAuth from AppStore" box and resubmitted for publishing so hopefully this does the trick.

However, I actually tested on a version=beta with my friend's seller account that's separate from my account and it did work! I'm so confused as you are what this version=beta means when I literally have production access now from as far as I can tell.

intellifox-hq commented 3 years ago

Hi @intellifox-hq thanks for the quick responses. Okay, looks like I am waiting to test this theory. I checked that "Enable the OAuth from AppStore" box and resubmitted for publishing so hopefully this does the trick.

However, I actually tested on a version=beta with my friend's seller account that's separate from my account and it did work! I'm so confused as you are what this version=beta means when I literally have production access now from as far as I can tell.

I would have thought it refers to the sandboxed environment, but it's more of a convenient way to migrate smoothly your users while still having both consent forms. That's pretty nice and for you it means your problem is solved ;) Congrats!

However for me it means I'm almost there.

intellifox-hq commented 3 years ago

Problem is now solved!

2 complete months to get there, but it's worth it! Look at how my customers received this new feature:

Screenshot_2021-01-23 Comment demander automatiquement des commentaires sur Amazon (Okay, I may have forced them to like the video for me to unlock the feature... But still! Video can be found here https://www.youtube.com/watch?v=U5-cnGQpXIc (it's in French))

Well that's it for this issue. Thank you for your support :+1:

diegocvazquez commented 3 years ago

@parvathm

Hello there I am facing the same issue regarding the Authorization API the error is: Developer ID 9xxxx7is not associated with the application id.

Our application is a Hybrid approved and published Application, I have created the case ID7011006982 Can you please help us?

thanks for your support

parvathm commented 3 years ago

Hi @diegocvazquez,

I have updated your application id to use Authorizations API. Can you please make the request again and let us know if the request is successful?

Thanks, Parvathm Selling Partner API Developer Support.

diegocvazquez commented 3 years ago

@parvathm It works now, thanks for your support.

sharoonthomas commented 3 years ago

@parvathm experiencing the same issue described above.

Developer ID 21** is not associated with the application id.

Case ID: 8378751301

Can you please help? Thank you for your support

parvathm commented 3 years ago

Hi @sharoonthomas,

Thank you for creating the case. I don't see your application id in the case details. Can you please provide the application id you are using in the case details so we can investigate and provide an update soon.

Thanks, Parvathm Selling Partner API Developer Support.

sharoonthomas commented 3 years ago

Hi @sharoonthomas,

Thank you for creating the case. I don't see your application id in the case details. Can you please provide the application id you are using in the case details so we can investigate and provide an update soon.

Thanks, Parvathm Selling Partner API Developer Support.

Just updated the ticket with the application id @parvathm

Thanks again

x64code commented 3 years ago

@parvathm

We are experiencing the same issue.. I have two cases: ID8389726291 and ID8300421291

can you please enable the authorizations api for our account? this is urgent

Thanks!

norbertmwk commented 3 years ago

@parvathm we are expecting the same issue,

Developer ID 23xxxxxxxxxx is not associated with the application id.

Case ID: 8407872901

Any chance you could help? Thanks!

ibrahimzahoor commented 3 years ago

@parvathm we are Experiencing the same issue,

Case ID: 8407930881

Any chance you could help? Thanks!

parvathm commented 3 years ago

@sharoonthomas, We have updated your app please try now. @aaronkramer, Case id's you provided seems to with app listing. Please give us the case id related to error message in this issue. @norbertmwk @ibrahimzahoor Thank you for providing the case ids. I am looking into it and get back to you soon.

Thanks, Parvathm Selling Partner API Developer Support.

x64code commented 3 years ago

@parvathm i have opened a new case: 8411649301

Can you please take a look?

Thanks!

EstebanSP-506 commented 3 years ago

@norbertmwk We have updated your app please try now.

@aaronkramer The app was submitted for publishing already. Once status is published, authorizations api should be working as expected.

@ibrahimzahoor You need to submit app for publishing.

Thanks, Esteban Selling Partner API Developer Support.

ibrahimzahoor commented 3 years ago

@parvathm @EstebanSP-506 I have opened a new case: 7055127632 for a different app that is published. Amazon EU App store

Can you please take a look?

Thanks!

norbertmwk commented 3 years ago

Thanks @EstebanSP-506 the problem seems to be solved now, I'm still getting an error that application is missing OAuth setup when trying to use Authorization API but this looks like something I can easily solve, thanks!

hoangtrucit commented 3 years ago

@parvathm I have opened a case: 8416507401

Can you help me?

Thanks

bendev7 commented 3 years ago

@parvathm @EstebanSP-506 I am having the same error, I have opened a case with id: 8416765651. Could someone please take a look? Thank you so much!

ibrahimzahoor commented 3 years ago

@ibrahimzahoor You need to submit app for publishing.

Thanks, Esteban Selling Partner API Developer Support.

@parvathm The app status is already published and I have verified again, kindly let me know how it can be fixed?

cgaugel commented 3 years ago

Same problem here @parvathm . My Case-ID: 7076796002

norbertmwk commented 3 years ago

@parvathm sorry to bother you again but could you or someone else look into case id 8443607041? Developer ID 23xxxxxxxxxx is not associated with the application id. is resolved but now the API throws application is missing OAuth setup.. The OAuth redirect URI is now added but it's not very clear how long it might take to publish changes and that thing is blocking the migration from MWS to SP API :|

cgaugel commented 3 years ago

Still no update. Help us @parvathm

parvathm commented 3 years ago

Hi all,

We are working on your cases and will provide any update soon.

Thanks, Parvathm Selling Partner API Developer Support.

S4T-TP commented 3 years ago

Hello @parvathm ,

we are facing the same problem as described above. Our case ID is 6916088232.

Can you please take a look at our case too?

Best regards S4T

LukeLim81 commented 3 years ago

Hello @parvathm,

I am also facing the same error message "Developer ID xxxxx is not associated with the application id."

Mine is a hybrid approach. The status is: "Published. Current edit is pending approval."

My case Id is 8475733711

Can you please assist?

Thanks!

BookLaugh commented 3 years ago

Hello @parvathm

Same issue here: "Developer ID xxxxx is not associated with the application id."

I'm working on migrating MWS application to SP-API, so I need to use Authorization API.

Application is in Published status, but I bet it needs enabling Authorization API.

Can you please assist me - where should I seek guidance or report this issue?

One2r commented 2 years ago

Hello @parvathm ,

we are facing the same problem as described above. Our case ID is 9015388551.

Can you please take a look at our case too?

bob-zen commented 2 years ago

Hi @parvathm

I am facing the same problem. My case ID is 7508174912

AntanasMisiunas commented 2 years ago

Hi @parvathm ,

We're having the same issue. We've opened a support ticket with id 9301898371.

parvathm commented 2 years ago

Hi,

We are working on these cases and will provide an update asap. Appreciate your patience.

Thanks, SP API Developer Support, Parvathm

AndrewTamb commented 2 years ago

@parvathm please help me too My ticket's id is 8826823581