Implementation for oauth2 authentication using a redirect flow (without window popup) from frontend to backend API, followed by a redirect back to the fronted. A localstorage provider token is added before the redirect to the backend auth API.

During the subsequent front end refresh an asynchronous backstage session refresh is triggered when the provider token is put in localstorage. The session refresh will return a backstage authentication token if authentication succeeded during the previous backend auth API execution.

Addresses https://github.com/backstage/backstage/issues/9582

Signed-off-by: headphonejames <generalfuzz@gmail.com>
This commit is contained in:
headphonejames
2023-01-18 14:32:00 -08:00
parent 9d207058d3
commit 9a9170047b
31 changed files with 426 additions and 334 deletions
@@ -131,6 +131,7 @@ export const apis = [
discoveryApi,
oauthRequestApi,
environment: configApi.getOptionalString('auth.environment'),
usePopup: configApi.getOptionalBoolean('auth.usePopup'),
}),
}),
createApiFactory({
@@ -145,6 +146,7 @@ export const apis = [
discoveryApi,
oauthRequestApi,
environment: configApi.getOptionalString('auth.environment'),
usePopup: configApi.getOptionalBoolean('auth.usePopup'),
}),
}),
createApiFactory({
@@ -160,6 +162,7 @@ export const apis = [
oauthRequestApi,
defaultScopes: ['read:user'],
environment: configApi.getOptionalString('auth.environment'),
usePopup: configApi.getOptionalBoolean('auth.usePopup'),
}),
}),
createApiFactory({
@@ -174,6 +177,7 @@ export const apis = [
discoveryApi,
oauthRequestApi,
environment: configApi.getOptionalString('auth.environment'),
usePopup: configApi.getOptionalBoolean('auth.usePopup'),
}),
}),
createApiFactory({
@@ -188,6 +192,7 @@ export const apis = [
discoveryApi,
oauthRequestApi,
environment: configApi.getOptionalString('auth.environment'),
usePopup: configApi.getOptionalBoolean('auth.usePopup'),
}),
}),
createApiFactory({
@@ -202,6 +207,7 @@ export const apis = [
discoveryApi,
oauthRequestApi,
environment: configApi.getOptionalString('auth.environment'),
usePopup: configApi.getOptionalBoolean('auth.usePopup'),
}),
}),
createApiFactory({
@@ -217,6 +223,7 @@ export const apis = [
oauthRequestApi,
defaultScopes: ['team'],
environment: configApi.getOptionalString('auth.environment'),
usePopup: configApi.getOptionalBoolean('auth.usePopup'),
}),
}),
createApiFactory({
@@ -231,6 +238,7 @@ export const apis = [
discoveryApi,
oauthRequestApi,
environment: configApi.getOptionalString('auth.environment'),
usePopup: configApi.getOptionalBoolean('auth.usePopup'),
});
},
}),