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

Reconciling API key, login email, and API organization #10

Open
eroten opened this issue Nov 18, 2022 · 0 comments
Open

Reconciling API key, login email, and API organization #10

eroten opened this issue Nov 18, 2022 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@eroten
Copy link
Collaborator

eroten commented Nov 18, 2022

API keys and login emails are tied to specific API organizations. However, if users are collaborating and their email is not registered with the same API org, it causes errors.

check_streetlight_api() only checks the API key itself, not any associated login emails. You won't run into any errors until you try to create or access an analysis using a different login email.

Liz's email is registered "mndot_metcouncil_api"
Raven's is registered with "mndot_master"

Both of us have access to StreetLight through the same contract with MnDOT.

function login_email api_key status
check_streetlight_api() NA "Myxxxxx" ✔️
check_streetlight_api() NA "9bxxxxx" ✔️
create_streetlight_analysis() raven.mcknight "9bxxxxx" ✔️
create_streetlight_analysis() raven.mcknight "Myxxxxx"
create_streetlight_analysis() liz.roten "Myxxxxx" ✔️
create_streetlight_analysis() liz.roten "9bxxxxx"

Worked examples

Here, we use Raven's key and Raven's email to create a new analysis and get "Analysis name must be unique" ✔️

library(streetlightR)
streetlight_api_key("9bxxxxxxxx")
#> ℹ Your API key has been added to your environment for this session only.
#> ℹ To install your API key for use in future sessions, run this function with
#>   `install = TRUE`.
check_streetlight_api() # passes
#> ✔ API connection live
#> [1] "PASS"

create_streetlight_analysis(login_email = "[email protected]",
                            analysis_type = "Zone_Activity_Analysis",
                            analysis_name = "bike_gate_nov16_test",
                            travel_mode_type = "Bicycle",
                            output_type = "Volume",
                            origin_zone_set = "mndot_gate_validation_osm_nov16",
                            tags = list("streetlightR"))
#> Warning: Create analysis failed with message:
#> Analysis name has to be unique.

Created on 2022-11-18 with reprex v2.0.2

Here, we run with Liz's API key, and Raven's email, but get an error ❌

library(streetlightR)
streetlight_api_key("Myxxxxxxx")
#> ℹ Your API key has been added to your environment for this session only.
#> ℹ To install your API key for use in future sessions, run this function with
#>   `install = TRUE`.
check_streetlight_api() # passes
#> ✔ API connection live
#> [1] "PASS"

create_streetlight_analysis(login_email = "[email protected]",
                            analysis_type = "Zone_Activity_Analysis",
                            analysis_name = "bike_gate_nov16_test",
                            travel_mode_type = "Bicycle",
                            output_type = "Volume",
                            origin_zone_set = "mndot_gate_validation_osm_nov16",
                            tags = list("streetlightR"))
#> Warning: Create analysis failed with message:
#> User '[email protected]' does not have access to the current api
#> organization.

Created on 2022-11-18 with reprex v2.0.2

However, if we try with Raven's key and Liz's email, we get an error ❌

library(streetlightR)
streetlight_api_key("9bxxxxxxxxx")
#> ℹ Your API key has been added to your environment for this session only.
#> ℹ To install your API key for use in future sessions, run this function with
#>   `install = TRUE`.
check_streetlight_api() # passes
#> ✔ API connection live
#> [1] "PASS"

create_streetlight_analysis(login_email = "[email protected]",
                            analysis_type = "Zone_Activity_Analysis",
                            analysis_name = "bike_gate_nov16_test",
                            travel_mode_type = "Bicycle",
                            output_type = "Volume",
                            origin_zone_set = "mndot_gate_validation_osm_nov16",
                            tags = list("streetlightR"))
#> Warning: Create analysis failed with message:
#> Analysis name has to be unique.

Created on 2022-11-18 with reprex v2.0.2

@eroten eroten added the bug Something isn't working label Nov 18, 2022
@eroten eroten self-assigned this Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant