Skip to content
Merged
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: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ REACT_APP_IMAGE_API_ROOT=https://planetarycomputer-staging.microsoft.com/api/f
# Client Id for Azure Maps
REACT_APP_AZMAPS_CLIENT_ID=8f49b6d6-5845-4e20-9015-9630df1ca8d2

# Subscription Key for Azure Maps
REACT_APP_AZMAPS_KEY=

# URL for JHub cloned repo launch (including 'git-pull')
REACT_APP_HUB_URL=
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
REACT_APP_AZMAPS_CLIENT_ID: ${{ secrets.AZMAPS_CLIENT_ID }}
REACT_APP_ONEDS_TENANT_KEY: ${{ secrets.ONEDS_TENANT_KEY }}
REACT_APP_HUB_URL: ${{ secrets.HUB_URL }}
REACT_APP_AZMAPS_KEY: ${{ secrets.AZMAPS_KEY }}
steps:
- uses: actions/checkout@v3
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
REACT_APP_AZMAPS_CLIENT_ID: ${{ secrets.AZMAPS_CLIENT_ID }}
REACT_APP_ONEDS_TENANT_KEY: ${{ secrets.ONEDS_TENANT_KEY }}
REACT_APP_HUB_URL: ${{ secrets.HUB_URL }}
REACT_APP_AZMAPS_KEY: ${{ secrets.AZMAPS_KEY }}
steps:
- uses: actions/checkout@v3
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
REACT_APP_AZMAPS_CLIENT_ID: ${{ secrets.AZMAPS_CLIENT_ID }}
REACT_APP_ONEDS_TENANT_KEY: ${{ secrets.ONEDS_TENANT_KEY }}
REACT_APP_HUB_URL: ${{ secrets.HUB_URL }}
REACT_APP_AZMAPS_KEY: ${{ secrets.AZMAPS_KEY }}
steps:
- uses: actions/checkout@v3
with:
Expand Down
25 changes: 14 additions & 11 deletions api/map-token/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ class TokenResponse(TypedDict):
def main(req: func.HttpRequest) -> func.HttpResponse:

logger.debug("Python HTTP trigger function processed a request.")
try:
logger.debug("Getting azure maps token")
token = credential.get_token("https://atlas.microsoft.com/.default")
logger.debug("Token acquired")

resp: TokenResponse = {"token": token.token, "expires_on": token.expires_on}

return func.HttpResponse(status_code=200, body=json.dumps(resp))
except ClientAuthenticationError:
logger.exception(f"Error getting azure maps token")
return func.HttpResponse("Error getting token", status_code=500)
# Comment out the implementation below and fail this call forcibly
return func.HttpResponse("This API is not implemented yet", status_code=501)
# Uncomment the implementation below to enable token retrieval
# try:
# logger.debug("Getting azure maps token")
# token = credential.get_token("https://atlas.microsoft.com/.default")
# logger.debug("Token acquired")

# resp: TokenResponse = {"token": token.token, "expires_on": token.expires_on}

# return func.HttpResponse(status_code=200, body=json.dumps(resp))
# except ClientAuthenticationError:
# logger.exception(f"Error getting azure maps token")
# return func.HttpResponse("Error getting token", status_code=500)
2 changes: 2 additions & 0 deletions cypress/e2e/explorer/selector.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ describe("Explorer selector tests", () => {
cy.contains("import planetary_computer");
cy.contains("Copy");

// Close the dialog with escape
cy.get("body").type("{esc}");
// Typing escape has closed the dialog
cy.contains("import planetary_computer").should("not.exist");

Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
- REACT_APP_AZMAPS_CLIENT_ID
- REACT_APP_ONEDS_TENANT_KEY
- REACT_APP_HUB_URL
- REACT_APP_AZMAPS_KEY
volumes:
- .:/usr/src
- ~/.npm:/root/.npm
Expand Down
5 changes: 2 additions & 3 deletions src/pages/Explore/components/Map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ const ExploreMap = () => {
style: DEFAULT_MAP_STYLE,
renderWorldCopies: true,
authOptions: {
authType: atlas.AuthenticationType.anonymous,
clientId: AZMAPS_CLIENT_ID,
getToken: fetchMapToken,
authType: atlas.AuthenticationType.subscriptionKey,
subscriptionKey: process.env.REACT_APP_AZMAPS_KEY,
},
transformRequest: addEntityHeader,
});
Expand Down
Loading