{"id":17449528,"url":"https://github.com/jplane/pbi-flask-oauth","last_synced_at":"2025-07-26T12:11:58.150Z","repository":{"id":95098324,"uuid":"222724909","full_name":"jplane/pbi-flask-oauth","owner":"jplane","description":"Flask API protected by Azure AD + OAuth2 with a Power BI Desktop client","archived":false,"fork":false,"pushed_at":"2019-11-21T03:13:38.000Z","size":86,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T05:25:38.455Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jplane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-19T15:13:08.000Z","updated_at":"2019-11-21T01:33:02.000Z","dependencies_parsed_at":"2023-05-26T15:45:47.924Z","dependency_job_id":null,"html_url":"https://github.com/jplane/pbi-flask-oauth","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jplane%2Fpbi-flask-oauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jplane%2Fpbi-flask-oauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jplane%2Fpbi-flask-oauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jplane%2Fpbi-flask-oauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jplane","download_url":"https://codeload.github.com/jplane/pbi-flask-oauth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245967736,"owners_count":20701889,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-17T21:42:01.607Z","updated_at":"2025-03-28T04:23:14.260Z","avatar_url":"https://github.com/jplane.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Sample: AAD-protected Flask API + Power BI Desktop custom connector\n\nThe Flask app uses [python-jose-cryptodome](https://pypi.org/project/python-jose-cryptodome/) to decode incoming Azure AD bearer tokens created using OAuth2 flows like [auth code flow](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow) or [client credential flow](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow).\n\nThe Power BI custom connector uses auth_code flow for its AAD token.\n\n### Setup:\n\n* Register an application in Azure AD and obtain the app_id and tenant_id. You'll also need to configure a redirect URL value of https://oauth.powerbi.com/views/oauthredirect.html\n\n* Add your app_id to [pbi-connector/client_id](pbi-connector/client_id) as the only contents of that file\n\n* In [pbi-connector/MyGraph.pq](pbi-connector/MyGraph.pq) replace TENANT-ID with your tenant_id from Azure AD app registration\n\n* Modify [flask-oauth-azure/.env](flask-oauth-azure/.env) with your tenant_id\n\n* You'll need Visual Studio + [Power Query SDK](https://marketplace.visualstudio.com/items?itemName=Dakahn.PowerQuerySDK) to build the pbi-connector project\n\n* The Flask app runs in Docker... you can run it directly on your laptop, but whyyy\n\n### Build and run the API\n\n* Run [build.sh](build.sh) to build the Docker image\n\n* Run [run.sh](run.sh) to run the image, the server is visible at http://localhost:5000. Use the /data secure endpoint to retrieve data\n\n### Build and deploy the Power BI connector\n\n* Build the pbi-connector project in Visual Studio and use F5 debugging to test it within VS\n\n* [Deploy the PBI custom connector .mez file](https://github.com/microsoft/DataConnectors/blob/master/docs/m-extensions.md#build-and-deploy-from-visual-studio)\n\n* [Configure and run the connector](https://github.com/microsoft/DataConnectors)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjplane%2Fpbi-flask-oauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjplane%2Fpbi-flask-oauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjplane%2Fpbi-flask-oauth/lists"}