@mastra/auth-workos 1.5.0-alpha.0 → 1.5.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/dist/auth-provider.d.ts +8 -2
- package/dist/auth-provider.d.ts.map +1 -1
- package/dist/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +5 -6
package/dist/index.js
CHANGED
|
@@ -51,6 +51,12 @@ function mapWorkOSUserToEEUser(user) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
// src/auth-provider.ts
|
|
54
|
+
function getWebRequest(request) {
|
|
55
|
+
if (request instanceof Request) {
|
|
56
|
+
return request;
|
|
57
|
+
}
|
|
58
|
+
return request.raw instanceof Request ? request.raw : void 0;
|
|
59
|
+
}
|
|
54
60
|
var DEV_COOKIE_PASSWORD = crypto.randomUUID() + crypto.randomUUID();
|
|
55
61
|
var MEMBERSHIP_CACHE_TTL_MS = 60 * 1e3;
|
|
56
62
|
var MEMBERSHIP_CACHE_MAX_SIZE = 1e3;
|
|
@@ -131,8 +137,8 @@ var MastraAuthWorkos = class extends MastraAuthProvider {
|
|
|
131
137
|
*/
|
|
132
138
|
async authenticateToken(token, request) {
|
|
133
139
|
try {
|
|
134
|
-
const
|
|
135
|
-
const { auth } = await this.authService.withAuth(
|
|
140
|
+
const webRequest = getWebRequest(request);
|
|
141
|
+
const { auth } = webRequest ? await this.authService.withAuth(webRequest) : { auth: { user: null } };
|
|
136
142
|
if (auth.user) {
|
|
137
143
|
let memberships;
|
|
138
144
|
if (this.fetchMemberships) {
|