Transfer authorization and refresh token

  1. Walmart passes the authorization code grant to the solution provider.

    Walmart redirects to the Solution Provider’s Auth Callback URL with the following query parameters:



    ParameterDescription
    codeAuthorization code that the solution provider app exchange for a refresh token
    typeIn this case, type=auth
    clientIdPre-registered identifier that uniquely identifies a solution provider app. The Walmart authorization server returns the same clientId that is passed by the app
    stateThe state value that is passed by the solution provider app
    sellerIdWalmart identifier of the seller who is authorizing the solution provider app

For example:

https://example-client-app.com/resource/applanding? code=4B582420568D428A931E4D6750%5B…%5Dr&type=auth&clientId=66874dfd-1d5g-476v-8k2c-e22g46c6727k&sellerId=456782346&state=A0YFFJJQMD

  • The solution provider’s app validates the state value.
  • The solution provider’s app saves the sellerId and the authorization code.
  1. The solution provider’s exchanges the authorization code for a refresh token.
  • The solution provider’s app calls the Walmart API server to get the OAuth access token and refresh token using the authorization code, sellerId, and application credentials.

    • Request URI:

    • Request method: POST

    • Request headers:


      ParameterDescriptionSample
      WM_PARTNER.IDSellerId received with authorization code in step 5.43423324
      WM_MARKETOptional. Default: us (USA) Available marketplace location: us (USA), mx (Mexico) or ca (Canada)us, mx or ca
      AuthorizationBasic authentication using clientId and client secret of your app.Basic e3tjbGllbnRfaWR9fTp7e2XR9fQ==
      Content-TypeContent type of the request body.application/x-www-form-urlencoded
      WM_CONSUMER.CHANNEL.TYPEOptional. A unique ID to track the consumer request by channel. Use the Consumer Channel Type received during onboarding
      WM_QOS.CORRELATION_IDA unique ID which identifies each API call and used to track and debug issues; use a random generated GUID for this IDb3261d2d-028a-4ef7-8602-633c23200af6
      WM_SVC.NAMEWalmart Service NameWalmart Marketplace

Request body:

ParameterDescriptionSample
grant_typeType of grant requestedauthorization_code
codeThe authorization code received as part of step 5.65CA5DA313A549D49D15D3119D9AD85D
redirect_uriThis should be same as one of your URI provided while registering the app.https://example-client-app.com
  1. The Walmart API server returns the OAuth access token and refresh token.

    The response includes access_token, refresh_token, token_type, and expires_in in JSON format.


    ParameterDescriptionSample
    access_tokenAccess token to be used for accessing business APIseyJraWQiOiI1MWY3MjM0Ny0wYWY5LTRhZ….  
    refresh_tokenToken which should be used to refresh the access token.APXcIoTpKMH9OQN…….  
    token_typeToken TypeBearer
    expires_inExpiry time of the access token in seconds900

    The solution provider’s app updates the sellerId and the authorization code mapping with the sellerId and refresh token to make requests to the Walmart Marketplace APIs.

  2. Fetch the new access token with the refresh token

  • An access token expires after a certain interval, so you will have to refresh a user’s access token. You could use the refresh token, obtained from the token API call using the authorization code grant type, to get a new access token. Refresh tokens remain valid for a year.

Request headers:

ParameterDescriptionSample
WM_PARTNER.IDPartner Id registered in Walmart marketplace to identify a seller43423324
WM_MARKETOptional. Default: us (USA) Available marketplace location: us (USA), mx (Mexico), or ca (Canada)us, mx or ca
AuthorizationBasic authentication using clientId and client secret of your appBasic e3tjbGllbnRfaWR9fTp7e2XR9fQ==
Content-TypeContent type of the request bodyapplication/x-www-form-urlencoded
WM_CONSUMER.CHANNEL.TYPEOptional. A unique ID to track the consumer request by channel. Use the Consumer Channel Type received during onboarding 
WM_QOS.CORRELATION_IDA unique ID which identifies each API call and is used to track and debug issues; use a random generated GUID for this IDb3261d2d-028a-4ef7-8602-633c23200af6
WM_SVC.NAMEWalmart Service NameWalmart Marketplace

Request body:

ParameterDescriptionSample
grant_typeType of grant requestedrefresh_token
refresh_tokenRefresh token received as the response of Authentication APIAPXcIoTpKMH9OQN…….
  1. Walmart API Server returns the new OAuth access token.

The response includes access_token, token_type and expires_in in JSON format.

ParameterDescriptionSample
access_tokenAccess token to be used for accessing business APIseyJraWQiOiI1MWY3MjM0Ny0wYWY5LTRhZ….
token_typeToken TypeBearer
expires inExpiry time of access token in seconds900