You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: oauth_sample/README.md
+11-24Lines changed: 11 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,18 @@
1
1
# QPP OAuth Sample Client
2
2
3
-
Node.js client application to demonstrate OpenID Connect + OAuth 2.0 integration with [QPP](https://qpp.cms.gov).
4
-
5
-
Supports both the [authorization code flow](http://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-4.1) and the [authorization code flow with PKCE](https://tools.ietf.org/html/rfc7636).
6
-
For your application, you will only need to support **one** of these flows.
7
-
8
-
## Requirements
9
-
10
-
This application has been tested on Node.js v22.2.0.
3
+
Example client application to demonstrate [OAuth 2.0](https://www.oauth.com/) + [OpenID Connect](https://openid.net/developers/how-connect-works/) integration with [QPP](https://qpp.cms.gov).
11
4
12
5
## Getting started
13
6
14
7
### Installation
15
8
16
-
Install the dependencies:
17
-
18
-
```bash
19
-
npm ci
20
-
```
9
+
This application has been tested on Node.js v22. Install dependencies by running `npm ci`.
21
10
22
11
### Setup
23
12
24
13
First, ensure you've created a QPP Developer Preview account and registered a new OAuth application by following the instructions on [this page](https://cmsgov.github.io/qpp-submissions-docs/getting-started-with-oauth).
25
14
26
-
Many of the fields required for registration may contain arbitrary "dummy" values (like `privacyPolicyURI` or `tosURI`), but the following *must* be configured correctly in order to use the sample client:
15
+
Many of the fields required for registration may contain arbitrary "dummy" values (like `privacyPolicyURI` or `tosURI`), but the following **must** be configured correctly in order to use the sample client:
27
16
*`redirectURIs` - *must* contain the absolute URL to the `/logged_in` endpoint for your development server
28
17
* e.g. `http://localhost:3000/logged_in`
29
18
*`logoutURIs` - *must* contain the absolute URL to the `/logged_out` endpoint for your development server
@@ -32,9 +21,9 @@ Many of the fields required for registration may contain arbitrary "dummy" value
32
21
*`web` applications are typical web apps with a backend server. They will receive both a client ID and a client secret.
33
22
*`native` applications are client-side apps (e.g. mobile/desktop apps). They will receive only a client ID, since a client secret cannot be stored safely.
34
23
35
-
After registering the application, copy `.example.env` to `.env` and use the returned client information to populate the following values in `.env`:
*`CLIENT_SECRET` - Registered client secret. Required for applications of type `web`, which can securely store a secret on the backend. For `native` applications, leave this blank and be sure to use the [PKCE flow](https://tools.ietf.org/html/rfc7636) for authorization (see the `/login-pkce` endpoint below).
24
+
After registering the application, copy `.example.env` to `.env` and use your new client information to populate the following values in `.env`:
*`CLIENT_SECRET` - Registered client secret. Required for applications of type `web`, which can securely store a secret on the backend. For `native` applications, leave this blank.
38
27
*`LOGIN_REDIRECT_URL` - The registered post-login redirect URL (i.e. the value you chose to put in `redirectURIs`)
39
28
*`LOGOUT_REDIRECT_URL` - The registered post-logout redirect URL (i.e. the value you chose to put in `logoutURIs`)
40
29
@@ -57,18 +46,16 @@ Serves as a basic homepage for the application. Contains information about the c
57
46
58
47
#### `/login`
59
48
60
-
Begins the [authorization code flow](http://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-4.1). Only applicable for applications of type `web`. For `native` applications, see `/login-pkce`.
61
-
62
-
#### `/login-pkce`
49
+
Begins the [OAuth 2.0 authorization code flow](https://www.oauth.com/oauth2-servers/pkce/authorization-request/). Note that, for additional security, the [Proof Key for Code Exchange](https://www.oauth.com/oauth2-servers/pkce/) extension is used regardless of the application type.
63
50
64
-
Begins the [authorization code flow with PKCE](https://tools.ietf.org/html/rfc7636). Only applicable for applications of type `native`. For `web` applications, see `/login`.
51
+
If you are testing your application in the QPP Developer Preview environment, please reserve scenarios beforehand using the [My Test Data](https://preview.qpp.cms.gov/user/test-data) section in the Developer Preview UI or the [QPP Synthetic Test Data API](https://preview.qpp.cms.gov/api/synthetic-data/docs/index.html).
65
52
66
53
#### `/logged_in`
67
54
68
55
Post-login redirect endpoint to receive the authorization code. This endpoint fetches tokens from the authorization server and sets the following cookies:
69
-
-`qpp_access_token` - the access token, used to authorize against QPP APIs like the [the Auth service API](https://preview.qpp.cms.gov/api/auth/docs) or the [submissions API](https://preview.qpp.cms.gov/api/submissions/public/docs/). The access token must be sent in the `Authorization` header in the format `Bearer <access_token>`. Your application should not attempt to parse the contents of this token.
56
+
-`qpp_access_token` - the access token, used to authorize against QPP APIs like the [the Auth service API](https://preview.qpp.cms.gov/api/auth/docs) or the [submissions API](https://preview.qpp.cms.gov/api/submissions/public/docs/). The access token must be sent in the `Authorization` header in the format `Bearer <access_token>`. Your application **should not** attempt to parse the contents of this token.
70
57
-`qpp_refresh_token` - the refresh token, used to request a new access token from the authorization server
71
-
-`qpp_id_token` - the ID token, issued to your application as proof that the user is authenticated. Your application should parse/verify the contents of this token and use it to customize your UI if applicable.
58
+
-`qpp_id_token` - the [ID token](https://www.oauth.com/oauth2-servers/openid-connect/id-tokens/), issued to your application as proof that the user is authenticated. Your application should parse/verify the contents of this token and use it to customize your UI if applicable.
72
59
73
60
#### `/verify`
74
61
@@ -80,7 +67,7 @@ Uses the refresh token to request new tokens from the authorization server.
80
67
81
68
#### `/logout`
82
69
83
-
Revokes all tokens and signs the user out of CMS IDM.
70
+
[Revokes all tokens](https://oauth.net/2/token-revocation/) and [ends the user's session](https://openid.net/specs/openid-connect-rpinitiated-1_0.html).
0 commit comments