@things-factory/oauth2-client 6.2.42 → 6.2.48

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": "@things-factory/oauth2-client",
3
- "version": "6.2.42",
3
+ "version": "6.2.48",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -32,10 +32,10 @@
32
32
  "@operato/layout": "^1.0.1",
33
33
  "@operato/shell": "^1.0.1",
34
34
  "@operato/utils": "^1.0.1",
35
- "@things-factory/auth-base": "^6.2.42",
36
- "@things-factory/shell": "^6.2.42",
35
+ "@things-factory/auth-base": "^6.2.48",
36
+ "@things-factory/shell": "^6.2.48",
37
37
  "client-oauth2": "^4.3.3",
38
38
  "clipboard": "^2.0.6"
39
39
  },
40
- "gitHead": "cc76b5c3dea6a88d4381e914eeaaff9e102e672d"
40
+ "gitHead": "70ed4f01ef662cde4d99911dc9374abd564cbe0e"
41
41
  }
@@ -18,11 +18,25 @@ export class Oauth2ClientMutation {
18
18
  @Arg('oauth2Client') oauth2Client: NewOauth2Client,
19
19
  @Ctx() context: ResolverContext
20
20
  ): Promise<Oauth2Client> {
21
- const { origin } = context
22
21
  const { domain, user, tx } = context.state
23
22
 
24
- let url: URL = new URL(origin)
25
- url.protocol = protocol || url.protocol
23
+ const originalProtocol = context.headers['x-forwarded-proto']
24
+ const originalHost = context.headers['x-forwarded-host']
25
+ const originalPort = context.headers['x-forwarded-port']
26
+
27
+ if (originalProtocol && originalHost) {
28
+ var url: URL = new URL(`${originalProtocol}://${originalHost}`)
29
+ if (originalPort) {
30
+ url.port = originalPort
31
+ }
32
+ } else {
33
+ var url: URL = new URL(context.request.origin)
34
+ }
35
+
36
+ if (protocol) {
37
+ url.protocol = protocol
38
+ }
39
+
26
40
  url.pathname = '/oauth2-client/callback'
27
41
 
28
42
  return await tx.getRepository(Oauth2Client).save({