Can BigCommerce Private Apps use OAuth -


i confused bc documentation on api, because let create "draft apps" (private apps) , see in documentation "we not provide means of keeping oauth apps private.".

my concern here made changes might have affected few of private apps had running fine month ago. if can provide insight, appreciate greatly!

https://developer.bigcommerce.com/api/guides/oauth-transition

there nothing wrong creating oauth credentials "draft app" sole purpose of accessing api of store. not ever have publish app , app never made "public" in case. don't have bother 'load callback url' , filling out details on draft app, unless want provide interface in store.

the "draft app" function meant allow developers building apps bc app marketplace test apps in store before submission. however, can use make private application intended store - i'm including process here others!

making private app oauth (or how generate oauth credentials store)

what need
  • access account listed "store owner" of store want install app or ability person access complete couple steps
  • ability setup local or public url receive 'auth callback request'

getting started

the first thing should sort out making available local or public url can receive "auth callback" request. resource must able work on https connection ssl can self-signed. 'auth callback' request bigcommerce request have 3 query parameters on url: code, scope, , context.

described in greater detail here: https://developer.bigcommerce.com/api/callback#get-req

additional info

when building public app important service receiving auth callback request configured catch 3 query values , combine them information have. send of information in post bc oauth token service generate api token store. in addition want respond auth callback request 200 status , interface, or instructions, user.

in context of building private application don't need worry of that. need capture query values. if have go ahead , jump down section on generating api token below.

before moving on

you should have url path can receive request , captures query parameters. test out , make sure works. here couple example urls:
https://example.com/auth-callback
https://localhost:8000/auth-service

registering app

the key point here registration of app must be completed store owner account of store want install app. if have access store owner account credentials follow steps @ bottom of page:
https://developer.bigcommerce.com/api/registration

if working store owner can direct them complete steps above. need provide them auth callback url created completing step 9. load callback url have filled in default example provided can left in place.

scopes

when registering app able choose scopes app. simple leave them open best practice enable scopes need. here list of scopes:
https://developer.bigcommerce.com/api/scopes

if not sure whether or not need scope leave enabled because have re-generate api token (perform re-install of app) if have change scopes on app.

before moving on

you need have client_id , client_secret. if else registered app need ask them this. there view client id button provide after registering app.

generate auth callback request

you need person store owner access again step. need login store , go apps section on left side column. after click on marketplace -> my apps (in top-right) -> my draft apps

you should see list containing "apps" store owner has registered. choose 1 relating client_id plan use. click install app.

the auth callback request has been sent , done here. should expect see blank or grey page result unless responding auth callback request content. app awaiting authentication.

if using self-signed certificate

when auth callback url has self-signed certificate see "untrusted cert" error in browser when attempt installation of app. should choose trust certificate , continue.

before moving on

you should have received code, scope, , context @ auth callback url. if did not due not having ssl/tls @ server. can replay auth callback request many times needed cancelling installation of app in same place started it. can open dev tool , watch request happen see errors show in console. if continuing fail should reach out bigcommerce support or ask new question on here!

generating api token complete installation

follow steps here: https://developer.bigcommerce.com/api/callback#post-req

should have of details needed send post request bc auth token service @ https://login.bigcommerce.com/oauth2/token

make sure url encode content , should good! here site can url encode , decode you: http://meyerweb.com/eric/tools/dencoder/
careful of encoding & , = signs when being used separators between fields or between field/value (respectively).

before moving on

you should have received successful response auth service include api token. once have set access api of store. no longer need have auth callback url , available , can take down.

take note of context use create api path.

accessing api

now have api token , context set access api of store. start off simple request /time endpoint.

make request , include following headers (minus curly braces):

  • x-auth-client: {client_id}
  • x-auth-token: {api_token}
  • accept: application/json
  • content-type: application/json

send request url path of (minus curly braces):

https://api.bigcommerce.com/{context}/v2/time

if 200 response set!

additional notes - ways break credentials

once have generated api token app, app display in control panel icon in apps section. fact app there shows installed , allowing access. if uninstall app generated api token stop working.

changing scopes on installed app require re-installed correct token.

changing store owner email on store cause token stop working. api token tied store owner registered app.


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -