@solidstarters/solid-core 1.2.14 → 1.2.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidstarters/solid-core",
3
- "version": "1.2.14",
3
+ "version": "1.2.15",
4
4
  "description": "This module is a NestJS module containing all the required core providers required by a Solid application",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -74,8 +74,7 @@ export class GoogleAuthenticationController {
74
74
  }
75
75
 
76
76
  /**
77
- * This is just a dummy endpoint where we are passing in the accessCode, this will be configured in the .env as an environment variable and
78
- * will be passed the accessCode, using the accessCode the UI code on this page will mostly invoke the /iam/google/auth endpoint which will finally generate the JWT token.
77
+ * Use this endpoint to authenticate using an accessCode with Google.
79
78
  *
80
79
  * @param accessCode
81
80
  * @returns
@@ -925,7 +925,19 @@ export class AuthenticationService {
925
925
  await this.validateUserUsingGoogle(user);
926
926
 
927
927
  // finally we simply generate the tokens.
928
- return await this.generateTokens(user);
928
+ const tokens = this.generateTokens(user);
929
+ return {
930
+ user: {
931
+ email: user.email,
932
+ mobile: user.mobile,
933
+ username: user.username,
934
+ forcePasswordChange: user.forcePasswordChange,
935
+ id: user.id,
936
+ roles: user.roles.map((role, idx, roles) => role.name)
937
+ },
938
+ ...tokens
939
+ }
940
+
929
941
  }
930
942
 
931
943
  private isPasswordlessRegistrationEnabled() {
@@ -10,7 +10,7 @@ Let's say that:
10
10
  3. The backend redirects the tab to the Google login page where the user logs in.
11
11
  4. Once done, Google redirects the tab to the backend URL: https://solid.website.com/api/iam/google/connect/callback. When this callback comes, it comes with the users profile & access token.
12
12
  5. Then, the backend redirects the tab to the url of your choice with the param accessCode (example: http://website.com/connect/google/dummy-redirect?accessCode=eyfvg).
13
- 6. The frontend (http://website.com/connect/google/dummy-redirect) calls the backend with https://solid.website.com/api/iam/google/auth?accessCode=eyfvg that returns the Solid user profile with its jwt.
13
+ 6. The frontend (http://website.com/connect/google/dummy-redirect) calls the backend with https://solid.website.com/api/iam/google/authenticate?accessCode=eyfvg that returns the Solid user profile with its jwt.
14
14
  (Under the hood, the backend asks Google for the user's profile and a match is done on Google user's email address and Solid user's email address).
15
15
  7. The frontend now possesses the user's jwt, which means the user is connected and the frontend can make authenticated requests to the backend!
16
16