๐Ÿ‘จโ€๐Ÿ’ปAuthorizing users

Step 1. Redirecting users to SellSN

You'll need to redirect your users to SellSN to begin the authorization process, you can use the following URL template to do so.

https://dash.sellsn.io/oauth2/[App ID]

You can pass more arguments to the login page, find below a table of all the URL query parameters you can set

ParameterRequired?ExampleDescription

redirectUrl

https://my-site.com/return/sellsn

The authorized return URL to redirect users to after authorization has completed.

state

abc

The state to pass down to the redirect URL once authorized, can store specific values that might be useful to your application.

Step 2. Handling the return

Next, you'll need to exchange the returned access code for an API key to access the users account.

Once authorized, the user will be redirected to the given redirect URL in the previous step and we'll automatically add the following query parameters to the URL which you will need to perform the access code exchange process.

ParameterDescription

code

The access code for the exchange process, lasts 1 minute after issuance.

state

The state from the previous step (if provided).

Now, you can make a request to our API to get an API key to access the users account.

You need to provide your OAuth2 client secret only for the exchange access code request in the XOAuth2-Client-Secret header or your request will not be authorized.

And voila, you should have a valid JWT API key for the user in the data field of the exchange response.

Step 3. Using the API key

You from now can use the API key issued to access any endpoint that your app has permissions to access which is previously defined in your app settings. For example if I have users.view permissions then I can make a request to the Get User endpoint as seen below as long as I pass the API key in the Authorization header, for example Authorization: Bearer abc

Last updated