v1.1 - stable release
Stack Overflow for Teams Plugin for Backstage
Based on the existing Community Plugins for Stack Overflow, this version introduces three new plugins:
- A frontend plugin responsible for displaying Stack Overflow for Teams data.
- A backend plugin responsible for fetching and creating Stack Overflow for Teams data.
- An optional search module responsible for fetching and creating an index of all the questions of your Stack Overflow instance.
Detailed information can be found under the plugins folder.
Frontend Plugin
It provides the UI and interacts with the backend service to fetch data from your Stack Overflow Enterprise instance.
Components
-
<StackOverflowHub />
The below various components collectively create this informative hub. -
<StackOverflowMe />
Displays information about the authenticated user. -
<StackOverflowPostQuestionModal />
Provides a form for users to create a new Stack Overflow question. Once submitted, an API request is executed to create the question. -
<StackOverflowQuestion />
Retrieves questions from the API. Uses standard pagination, displaying only the first 30 API results. -
<StackOverflowTags />
Retrieves tags from the API. Uses standard pagination, displaying only the first 30 API results. -
<StackOverflowUsers />
Retrieves users from the API. Uses standard pagination, displaying only the first 30 API results.
Authentication components
-
<StackAuthStart />
Initiates/auth/starton the backend. -
<StackAuthLoading /> -
<StackAuthCallback />
Receives the code and state from your Stack Overflow Enterprise instance as part of the OAuth process and initiates/callbackin the backend. -
<StackAuthSuccess /> -
<StackAuthFailed />
Page
<StackOverflowTeamsPage />
This page triggers authentication components, if authenticated it will return the StackOverflow HUB.
API Requests
The frontend plugin creates and API Ref for StackOverflowforTeams which can be found under /api folder. All API requests from the frontend are directed to Backstage's backend.
Backend Plugin
The backend plugin is responsible for:
- Handling API requests via
createStackOverflowApiandcreateStackOverflowServiceto the Stack Overflow instance for retrieving:/users/tags/questions- Posting new questions via
/questions
- Managing OAuth authentication flow to securely access Stack Overflow. via
createStackOverflowAuth
OAuth Authentication Flow
The backend is the only component that directly utilizes Stack Overflow access tokens for requests.
Authorization Flow Details
/auth/start
- Generates PKCE Code Verifier.
- Hashes Code Verifier to obtain Code Challenge.
- Generates a state (random string).
- Stores Code Verifier and State in a secure, HTTP-only cookie accessible only to the server.
/callback
- Retrieves the stored Code Verifier and State.
- Validates that the received state matches the one from Stack Overflow's query string parameter.
- The backend requests an Access Token using the stored Code Verifier.
- Stores the Stack Overflow Access Token in a secure, HTTP-only cookie.
Search module
This module for the search plugin is an enhanced version of the original Stack Overflow collator. It provides additional information while coded to work specifically with Stack Overflow for Teams API Version 3.