Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

350 auth flow #47

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ NEXT_PUBLIC_PROVIDER_NAME=phenovista
NEXT_PUBLIC_PROVIDER_ID=12527
NEXT_PUBLIC_SCIENTIST_API_VERSION=v2
NEXT_PUBLIC_WEBHOOK_URL=http://ss-mailer/webstore
NEXT_PUBLIC_APP_BASE_URL=https://www.phenovista.vercel.app
NEXT_PUBLIC_APP_BASE_URL=https://phenovista.softserv.cloud/
NEXT_PUBLIC_CLIENT_BASE_URL=https://store.phenovista.cloud/
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# reference https://nextjs.org/docs/basic-features/environment-variables#exposing-environment-variables-to-the-browser
# to learn about the NEXT_PUBLIC prefix

NEXT_PUBLIC_APP_BASE_URL=https://store.webstore.com
NEXT_PUBLIC_APP_BASE_URL=https://webstore.softserv.com
NEXT_PUBLIC_PROVIDER_ID=0001
NEXT_PUBLIC_PROVIDER_NAME=webstore
NEXT_PUBLIC_SCIENTIST_API_VERSION=v2
NEXT_PUBLIC_WEBHOOK_URL=http://ss-mailer/webstore
NEXT_PUBLIC_CLIENT_BASE_URL=https://store.webstore.com
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ _The terms "client" and "provider" are fairly interchangeable in this applicatio
| NEXTAUTH_SECRET | Yes | .env.development | Used to encrypt the NextAuth.js JWT |
| NEXTAUTH_URL | Yes | .env.development | The authentication route used for NextAuth.js |
| NEXT_PUBLIC_APP_BASE_URL | Yes | .env | The URL to the deployed webstore instance |
| NEXT_PUBLIC_CLIENT_BASE_URL | No | .env | The URL to the Client CNAME that points at NEXT_PUBLIC_APP_BASE_URL |
| NEXT_PUBLIC_PROVIDER_ID | Yes | .env | The identifier of the client's marketplace in the database |
| NEXT_PUBLIC_PROVIDER_NAME | Yes | .env | The subdomain of the client's marketplace |
| NEXT_PUBLIC_SCIENTIST_API_VERSION | Yes | .env | The version of the API we should be talking to |
Expand Down
2 changes: 2 additions & 0 deletions charts/webstore/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ spec:
value: "{{ .Values.nextAuthUrl }}"
- name: NEXT_PUBLIC_APP_BASE_URL
value: "{{ .Values.appBaseUrl }}"
- name: NEXT_PUBLIC_CLIENT_BASE_URL
value: "{{ .Values.clientBaseUrl }}"
- name: NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID
value: "{{ .Values.googleTagManagerId }}"
- name: NEXT_PUBLIC_PROVIDER_ID
Expand Down
1 change: 1 addition & 0 deletions ops/production-deploy.tmpl.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
appBaseUrl: 'https://phenovista.softserv.cloud'
clientBaseUrl: 'https://store.phenovista.com'
clientId: $CLIENT_ID
clientSecret: $CLIENT_SECRET
googleTagManagerId: 'GTM-PQGCP24G'
Expand Down
1 change: 1 addition & 0 deletions ops/staging-deploy.tmpl.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
appBaseUrl: 'https://phenovista-staging.softserv.cloud'
clientBaseUrl: ''
clientId: $CLIENT_ID
clientSecret: $CLIENT_SECRET
googleTagManagerId: ''
Expand Down
9 changes: 9 additions & 0 deletions pages/api/auth/[...nextauth].js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ const authOptions = {
}
],
callbacks: {
async redirect({ url, baseUrl }) {
console.log({
url, baseUrl, client_url: process.env.NEXT_PUBLIC_CLIENT_BASE_URL,
url_Origin: new URL(url).origin,
baseUrl_Origin: new URL(baseUrl).origin,
clientUrl_Origin: new URL(process.env.NEXT_PUBLIC_CLIENT_BASE_URL).origin,
})
return baseUrl
},
async jwt({ token, account, user }) {
// Triggered on the initial sign in
if (account && user) {
Expand Down
Loading