Skip to content

Commit 4117c08

Browse files
committed
read me
1 parent ded48c0 commit 4117c08

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

README.md

+28
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,34 @@ app.get('/authenticatedRoute', passageAuthMiddleware, async (req, res) => {
101101
});
102102
```
103103

104+
## Retrieve User Info By Identifier
105+
106+
To retrieve information about a user, you can use the `passage.user.getUserByIdentifier()` function. You will need to use a Passage API key, which can be created in the Passage Console under your Application Settings. This API key grants your web server access to the Passage management APIs to get and update information about users. This API key must be protected and stored in an appropriate secure storage location. It should never be hard-coded in the repository.
107+
108+
```javascript
109+
import Passage from '@passageidentity/passage-node';
110+
import express from 'express';
111+
112+
const app = express();
113+
const port = 3000;
114+
115+
let passageConfig = {
116+
appID: 'YOUR_APP_ID',
117+
apiKey: 'YOUR_API_KEY',
118+
};
119+
let passage = new Passage(passageConfig);
120+
121+
// example authenticated route
122+
app.get('/authenticatedRoute', passageAuthMiddleware, async (req, res) => {
123+
// get user identifier from middleware
124+
let userEmail = res.userEmail;
125+
126+
// get user info
127+
let passageUser = await passage.user.getUserByIdentifier(userEmail);
128+
console.log(passageUser.id);
129+
});
130+
```
131+
104132
## Activate/Deactivate User
105133

106134
You can also activate or deactivate a user using the Passage SDK. These actions require an API Key and deactivating a user will prevent them from logging into your application with Passage.

0 commit comments

Comments
 (0)