Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Relabel and move explanation and how-tos around OAuth (Diátaxis) #9834

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e477553
WIP: Refactor explanation/howto revolving around OAuth
benjaoming Dec 21, 2022
8df0f34
Merge branch 'diataxis/main' of github.com:readthedocs/readthedocs.or…
benjaoming Jan 3, 2023
3194bac
Make it more clear to some users that they don't need to do anything …
benjaoming Jan 3, 2023
b09010d
Tested GitLab and Bitbucket, we need to add one permission to the list
benjaoming Jan 3, 2023
e8be1db
Adds a seealso:: back from howto to explanation
benjaoming Jan 3, 2023
4feccfd
Apply suggestions from code review @ericholscher
benjaoming Jan 4, 2023
ab8aaaa
read the dots - list entries end with a period
benjaoming Jan 4, 2023
2c1c278
Adds more explanation about how OAuth works and organizes permissions…
benjaoming Jan 4, 2023
76825b5
Merge branch 'diataxis/relabel-connected-accounts' of github.com:benj…
benjaoming Jan 4, 2023
8efb8d1
Add link to OAuth, remove redundant seealso
benjaoming Jan 5, 2023
995edbc
Update how-to guide and use place-holders for screenshots
benjaoming Jan 11, 2023
1020f08
Clarify ambiguous sign-up text
benjaoming Jan 11, 2023
f07de58
Add subsection about disconnecting a service
benjaoming Jan 11, 2023
ad99ed2
Add screenshots to howto
benjaoming Jan 12, 2023
fcee665
pre-commit is lit :fire:
benjaoming Jan 12, 2023
6e17ca2
Move to Explanation TOC section
benjaoming Jan 12, 2023
1b1adb4
Merge branch 'diataxis/main' of github.com:readthedocs/readthedocs.or…
benjaoming Jan 13, 2023
561fc91
Apply suggestions from code review @ericholscher
benjaoming Jan 13, 2023
4d1f205
Merge branch 'diataxis/relabel-connected-accounts' of github.com:benj…
benjaoming Jan 13, 2023
fd274d3
Apply the new substitution for Git providers
benjaoming Jan 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 116 additions & 57 deletions docs/user/connected-accounts.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,72 @@
Connecting Your VCS Account
===========================
Connecting your Git repository
==============================

In this article, we explain how connecting your Read the Docs account to one of the supported Git providers
automatically configures your Git repository and your Read the Docs project.

✅️ Signed up with your Git provider?
If you signed up or logged in to Read the Docs with your |git_providers_or|
credentials, you're all done. Your account is connected.
The permissions that are granted are :ref:`explained below <connected-accounts:Permissions for connected accounts>`.
⬇️ Signed up with your email address?
If you have signed up to Read the Docs with your email address,
you can add the connection to the Git provider afterwards.
See: :doc:`/guides/connecting-git-account`

If you are going to import repositories from |git_providers_or|,
we recommend that you connect your Read the Docs account to your Git provider.

If you are going to import repositories from GitHub, Bitbucket, or GitLab,
you should connect your Read the Docs account to your repository host first.
Connecting your account allows for:

* Easier importing of your repositories
* Automatically configure your repository :doc:`/integrations`
* Easy import of your repositories.
* Automatic configuration of your repository :doc:`/integrations`.
which allow Read the Docs to build your docs on every change to your repository
* Log into Read the Docs with your GitHub, Bitbucket, or GitLab credentials
* Logging into Read the Docs with your |git_providers_or| credentials.


.. seealso::

:ref:`intro/import-guide:Manually import your docs`
Using a different provider?
Read the Docs still supports other providers such as Gitea or GitHub Enterprise.
In fact, any Git repository URL can be configured manually.


.. tip::

A single Read the Docs account can connect to many different Git providers.
This allows you to have a single login for all your various identities.


If you signed up or logged in to Read the Docs with your GitHub, Bitbucket, or GitLab
credentials, you're all done. Your account is connected.
How does the connection work?
-----------------------------

Read the Docs uses `OAuth`_ to connect to your account at |git_providers_or|,
You are asked to grant permissions for Read the Docs to perform a number of actions on your behalf.

At the same time, we use this process for authentication (login)
since we trust that |git_providers_or| have verified your user account and email address.

By granting Read the Docs the requested permissions,
we are issued a secret OAuth token from your Git provider.

Using the secret token,
we can automatically configure the repository that you select in the :doc:`project import <intro/import-guide>`.
We also use the token to send back build statuses and preview URLs for :doc:`pull requests </pull-requests>`.

.. _OAuth: https://en.wikipedia.org/wiki/OAuth

.. note::

Access granted to Read the Docs can always be revoked.
This is a function offered by all Git providers.

To connect a social account, go to your :guilabel:`<Username dropdown>` > :guilabel:`Settings` > :guilabel:`Connected Services`.
From here, you'll be able to connect to your GitHub, Bitbucket or GitLab
account. This process will ask you to authorize a connection to Read the Docs,
that allows us to read information about and clone your repositories.


Permissions for connected accounts
----------------------------------

Read the Docs does not generally ask for write permission to your repositories' code
Read the Docs does not generally ask for *write* permission to your repository code
(with one exception detailed below)
and since we only connect to public repositories we don't need special permissions to read them.
However, we do need permissions for authorizing your account
Expand All @@ -31,39 +75,72 @@ and to setup :doc:`/integrations`
which allow us to build your documentation on every change to your repository.


GitHub
~~~~~~
.. tabs::

Read the Docs requests the following permissions (more precisely, `OAuth scopes`_)
when connecting your Read the Docs account to GitHub.
.. tab:: GitHub

.. _OAuth scopes: https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/
Read the Docs requests the following permissions (more precisely, `OAuth scopes`_)
when connecting your Read the Docs account to GitHub.

Read access to your email address (``user:email``)
We ask for this so you can create a Read the Docs account and login with your GitHub credentials.
.. _OAuth scopes: https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/

Administering webhooks (``admin:repo_hook``)
We ask for this so we can create webhooks on your repositories when you import them into Read the Docs.
This allows us to build the docs when you push new commits.
Read access to your email address (``user:email``)
We ask for this so you can create a Read the Docs account and login with your GitHub credentials.

Read access to your organizations (``read:org``)
We ask for this so we know which organizations you have access to.
This allows you to filter repositories by organization when importing repositories.
Administering webhooks (``admin:repo_hook``)
We ask for this so we can create webhooks on your repositories when you import them into Read the Docs.
This allows us to build the docs when you push new commits.

Repository status (``repo:status``)
Repository statuses allow Read the Docs to report the status
(eg. passed, failed, pending) of pull requests to GitHub.
This is used for a feature currently in beta testing
that builds documentation on each pull request similar to a continuous integration service.
Read access to your organizations (``read:org``)
We ask for this so we know which organizations you have access to.
This allows you to filter repositories by organization when importing repositories.

.. note::
Repository status (``repo:status``)
Repository statuses allow Read the Docs to report the status
(eg. passed, failed, pending) of pull requests to GitHub.
This is used for a feature currently in beta testing
that builds documentation on each pull request similar to a continuous integration service.

.. note::

:doc:`Read the Docs for Business </commercial/index>`
asks for one additional permission (``repo``) to allow access to private repositories
and to allow us to setup SSH keys to clone your private repositories.
Unfortunately, this is the permission for read/write control of the repository
but there isn't a more granular permission
that only allows setting up SSH keys for read access.

.. tab:: Bitbucket

We request permissions for:

Administering your repositories (``repository:admin``)
We ask for this so we can create webhooks on your repositories when you import them into Read the Docs.
This allows us to build the docs when you push new commits.
NB! This permission scope does **not** include any write access to code.

Reading your account information including your email address
We ask for this so you can create a Read the Docs account and login with your Bitbucket credentials.

Read access to your team memberships
We ask for this so we know which organizations you have access to.
This allows you to filter repositories by organization when importing repositories.

Read access to your repositories
We ask for this so we know which repositories you have access to.

To read more about Bitbucket permissions, see `official Bitbucket documentation on API scopes`_

.. _official Bitbucket documentation on API scopes: https://developer.atlassian.com/cloud/bitbucket/bitbucket-cloud-rest-api-scopes/


.. tab:: GitLab

Like the others, we request permissions for:

* Reading your account information (``read_user``)
* API access (``api``) which is needed to create webhooks in GitLab

:doc:`Read the Docs for Business </commercial/index>`
asks for one additional permission (``repo``) to allow access to private repositories
and to allow us to setup SSH keys to clone your private repositories.
Unfortunately, this is the permission for read/write control of the repository
but there isn't a more granular permission
that only allows setting up SSH keys for read access.

.. _github-permission-troubleshooting:

Expand Down Expand Up @@ -97,21 +174,3 @@ depending on where the project you are trying to access has permissions from.
.. seealso:: GitHub doc on `requesting access to your organization OAuth`_ for step-by-step instructions.

.. _requesting access to your organization OAuth: https://docs.github.com/en/github/setting-up-and-managing-your-github-user-account/managing-your-membership-in-organizations/requesting-organization-approval-for-oauth-apps

Bitbucket
~~~~~~~~~

For similar reasons to those above for GitHub, we request permissions for:

* Reading your account information including your email address
* Read access to your team memberships
* Read access to your repositories
* Read and write access to webhooks

GitLab
~~~~~~

Like the others, we request permissions for:

* Reading your account information (``read_user``)
* API access (``api``) which is needed to create webhooks in GitLab
1 change: 1 addition & 0 deletions docs/user/guides/administrators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ have a look at our :doc:`/tutorial/index`.
:maxdepth: 1

Connect your git repository <git-integrations>
Connect your Read the Docs account to your Git repository <connecting-git-account>
Manage Custom Domains <custom-domains>
Enable Canonical URLs <canonical-urls>
technical-docs-seo-guide
Expand Down
70 changes: 70 additions & 0 deletions docs/user/guides/connecting-git-account.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
How to connect your Read the Docs account to your Git provider
==============================================================

In this how to article,
you are shown the steps to connect an account on |git_providers_or| with your Read the Docs account.
This is relevant if you have signed up for Read the Docs with your email
or if you have signed up using a Git provider account and want to connect additional providers.

If you are going to import repositories from |git_providers_or|,
you should connect your Read the Docs account to your Git provider first.

.. note::

If you signed up or logged in to Read the Docs with your |git_providers_or| credentials,
you're all done. Your account is connected ✅️.
You only need this how-to if you want to connect additional Git providers.


Adding a connection
-------------------

To connect your Read the Docs account with a Git provider,
go to the main login menu: :guilabel:`<Username dropdown>` > :guilabel:`Settings` > :guilabel:`Connected Services`.

From here, you'll be able to connect to your |git_providers_or|
account. This process will ask you to authorize an integration with Read the Docs.

.. figure:: /img/oauth_github_dialog.png
:width: 300px
:align: center
:alt: Screenshot of example OAuth dialog on GitHub

An example of how your OAuth dialog on GitHub may look.

After approving the request,
you will be taken back to Read the Docs.
You will now see the account appear in the list of connected services.

.. figure:: /img/screenshot_connected_services.png
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love Donald Docs as a test user 😆

:width: 600px
:align: center
:alt: Screenshot of Read the Docs "Connected Services" page with multiple services connected

Connected Services [#f1]_ [#f2]_ shows the list of Git providers that

Now your connection is ready and you will be able to import and configure Git repositories with just a few clicks.

.. seealso::

:doc:`/connected-accounts`
Learn about what a connected account with your Git provider is used for
and the permissions required for connecting accounts.

Removing a connection
---------------------

You may at any time delete the connection from Read the Docs.
Delete the connection makes Read the Docs forget the immediate access,
but you should also disable our OAuth Application from your Git provider.

* On GitHub, navigate to `Authorized OAuth Apps`_.
* On Bitbucket, navigate to `Application Authorizations`_.
* On GitLab, navigat to `Applications`_

.. _Authorized OAuth Apps: https://github.com/settings/applications
.. _Application Authorizations: https://bitbucket.org/account/settings/app-authorizations/
.. _Applications: https://gitlab.com/-/profile/applications

.. [#f1] `Connected Services on readthedocs.org <https://readthedocs.org/accounts/social/connections/>`_
.. [#f2] `Connected Services on readthedocs.com <https://readthedocs.com/accounts/social/connections/>`_
Binary file added docs/user/img/oauth_github_dialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/user/img/screenshot_connected_services.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions docs/user/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ to help you create fantastic documentation for your project.
/integrations
/custom-domains
/pull-requests
/connected-accounts
/downloadable-documentation
/subprojects
/single_version
Expand Down Expand Up @@ -155,8 +156,6 @@ and some of the core features of Read the Docs.
/server-side-search/index
/security-log

/connected-accounts

/builds
/build-customization
/build-troubleshooting
Expand Down
8 changes: 7 additions & 1 deletion docs/user/intro/import-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ these properties, and then click **Next** to
Manually import your docs
-------------------------

If you do not have a connected account, you will need to select **Import Manually**
If you have not :doc:`connected a Git provider account </guides/connecting-git-account>`,
you will need to select **Import Manually**
and enter the information for your repository yourself. You will also need to
manually configure the webhook for your repository as well. When importing your
project, you will be asked for the repository URL, along with some other
Expand All @@ -53,6 +54,11 @@ project on Read the Docs. Go to your project's :guilabel:`Admin` > :guilabel:`In
configure a new webhook, or see :ref:`our steps for webhook creation <integrations:Integration Creation>`
for more information on this process.

.. seealso::

:doc:`/guides/git-integrations`
Once you have imported your git project, use this guide to manually set up basic and additional integration.

.. note::
The ``Admin`` page can be found at ``https://readthedocs.org/dashboard/<project-slug>/edit/``.
You can access all of the project settings from the admin page sidebar.
Expand Down