PBS Account is PBS's OAuth 2 provider that also supports authentication via Google, Facebook, and Apple Oauth2 and can be used to implement login on station sites and for Passport. No profile information (e.g.: watch history, favorite shows and videos) is included.
Integration is based on OAuth 2. You can learn more about OAuth 2 here:
Begin by submitting a ticket to PBS support to request a client id, client secret, and scopes.
- Account - Access to user's PBS account. Necessary for logging users in.
- Station (this is automatically assigned) - Station can create their own access to features on their station site or app that PBS account cannot access.
- VPPA - Passport data.
Provide a redirect URI in your request. This is the URL you want your users to land on once they have successfully logged in to your site. This link can be anything as long as it's a valid landing page. Examples:
Development and testing
- Play around! Use the preconfigured Google OAuth 2 playground to view server requests and responses. Click here to access the playground
- Install or develop an OAuth 2 client. Each platform offers several options. In a browser window, search for "OAuth 2 client" plus your platform. For instance, search for OAuth 2 client Wordpress. A list of options should display.
- Develop and test! Develop and test your implementation on the PBS QA site before going live.
What you receive from PBS
After PBS processes your request, you will receive the following items:
Client id: Given to you by a PBS Account Admin
Client secret: Granted to you by a PBS Account Admin
- Scope(s): This denotes what you can do with your access token; currently PBS requires account and station name (e.g. 'wnet') scopes. Learn more about scopes
- Access token: This is actually dynamically provided via the OAuth 2 workflow
The following platforms can be included on your form:
- PBS Account
This section shows you how to implement each platform on your sign-in page.
Click image to enlarge
Create custom PBS Account sign-in link
Use the following code to display a custom PBS Account Sign In / Link page:
Custom sign in links - PBS Account
Social endpoints for custom sign-in
In order to begin the login process using a social provider, you need to redirect the user to the corresponding endpoint (e.g. through a button). Each of the endpoints below begin the social provider sign in process and, when finished, redirect the user to your website's landing page specified in your request ticket to PBS through the redirect_uri parameter.
Sample callback redirect request
After PBS Account authenticates a user, the user is redirected back to the redirect URI that you defined with an OAuth code in the URL.
Retrieve OAuth token
The code received in the redirect request should be exchanged on the server side for an OAuth token:
The client MUST NOT use the authorization code more than once, as specified in https://www.rfc-editor.org/rfc/rfc6749#section-4.1.2.
Sample token exchange response
The access token that is returned can be used to retrieve user information, including the user's PID, by calling the URL and passing in the access token as the Authorization header:
Sample user information response
If the token doesn't have the vppa scope, the "vppa" key will be null.
What's happening in the back-end
The Video Privacy Protection Act (VPPA) requires that Passport members who use PBS Video apps explicitly grant PBS permission to share the user’s personal data (viewing history, favorites, etc.) with the station. To be clear, the agreement is between the user and PBS, not the user and the station, which is why it is contained in an authentication flow managed by PBS.