Skip to content

How to create your application

Video instructions for creating credentials

Step by step to create your client:

Step 1 - Register your account.

Create an account with IdMagalu via this link.

Note

If you already have an account on the Magalu SuperApp or the Seller Portal, you can use the same login and password; otherwise, register!

Step 2- Download IDM

Download the file according to the operating system on the Releases page.

Step 3 - Make the file executable (optional)

Make the file executable from anywhere by moving it to the C:\Windows\System32 folder.

Warning

Avoid using CMD, always use Powershell to execute commands and use double quotes instead of single quotes.

Make the file executable

chmod +x idm

Make the file executable

chmod +x idm

Allow the app not downloaded from the App Store to run:

Configure IDM on macOS

Step 4 - Log in

Log in to your Magalu ID account using the command:

idm login

Step 5 - Create client

Variable table

Field Description
name Name of your application
description A description about the application.
terms-of-use The URL that leads to the terms of use.
privacy-term The URL for the privacy policy.
icon URL of the image or application icon.
redirect-uris A list of redirect URLs where users will be sent upon successful authorization. It must be separated by spaces.
scopes The list of access scopes, to add more than one scope, must be separated by space. The scopes allowed are:
  • open:order-order:read
  • open:portfolio:read
  • open:portfolio:write
  • open:queue-history:read
    reason An explanation of why the application needs the specified scopes, usually related to the user interface or functionality.
    audience The environment that will be used (only 1 value should be passed). See the environments here
    access-token-exp The lifetime of the access token in seconds. Maximum is 7200.
    always-require-login Ignore the active Magalu ID session and always require login (recommended to use false)

    Command

    Run the command:

    idm client create --name "client-name" --description "Client Description" --terms-of-use "http://terms.com.br" --privacy-term "http://term.com.br" --icon "http://icon.com/icon.png" --redirect-uris "https://redirect1.com https://redirect2.com" --scopes "open:portfolio:write open:portfolio:read open:order-order:read" --reason "Scopes needed by UI to" --audience "https://api-sandbox.magalu.com" --access-token-exp 7200 --always-require-login false
    

    Step 6 - Onboarding to create subscriptions

    In order to receive webhook notifications, subscriptions must be created via this [endpoint] (/docs/Onboarding/setup.en/).

    Other actions

    Adding a scope to an existing client

    To add a scope to an existing client, run the command:

    idm client add-scope --client-uuid "XXXXXX-XXXf-4XX2-8XXa9-37cXXXXXXd09" --scopes "scope-x scope-y" --reason "My client needs this scope because"
    

    List clients

    To list the clients created in your account, run the command:

    idm client list