A common use case for apps and elements is that the site owner must be registered with the app’s site in order to install and use it. For example, say you’re creating an app that allows the site owner to chat with their visitors. The site owner needs to have an account with you, the chat company, and needs to log into that account in order to install and use the chat app.

We want app installation to be as smooth and seamless as possible, so we definitely don’t want the user to have to exit Weebly to create an account or log in to another site and then come back to do the install. We’d like the user to be able to view the app in the App Center and start the install process immediately and seamlessly. We’ve implemented OAuth so that users can create an account or log in to your site during installation.

When users click Add on an App Card in the App Center, we send you encoded parameters that you need to decode and then return to us, along with the type of API access (scope) your app/element needs. When we receive this from you, we post a modal to the user asking for access to their site, based on the scope(s) you’ve sent. When they approve access by clicking Connect, we redirect the user to the URI you just provided, along with a temporary authorization code. Once authenticated, you return the user back to us and we’ll send you a permanent token. When you receive this, you direct the user to the final endpoint, signaling that the authorization flow has ended. Now that you have access to the API, you can get user information, like email, to create an account on your end, or if one already exists, log the user in.

Help make these docs better!