Skip to content

MarsWangyang/LogicApp_APIConnection_Authorization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Connection Auto Authentication

You can directly execute Windows or MacOS code locally after add .env file.
You must have Chrome browser first!

Before you start using it, clone this repository and choose what OS you use.

For Example (MacOS):

git clone https://github.com/MarsWangyang/LogicApp_APIConnection_Authorization.git
cd MacOS/
python3 -m venv .venv # create a virtual environment
source .venv/bin/activate # launch your virtual environment
pip install -r requirements.txt

Mac OS version

Service Principal

An Azure service principal is an identity created for use with applications, hosted services, and automated tools to access Azure resources. This access is restricted by the roles assigned to the service principal, giving you control over which resources can be accessed and at which level

Before using it, I choose Service Principal to implement this authentication. How to create a service principal? Check here

How to use:

  1. copy the information of the service principal you just created.
  2. add file .env
  3. revise .env file to changet to your service princial info and save it
    TENANT_ID=XXXXXXXX
    CLIENT_ID=XXXXXXXX
    CLIENT_SECRET=XXXXXXXX
    SUBSCRIPTION_ID=XXXXXXXX
    OBJECT_ID=XXXXXXX
    
  4. open main.py and press F5 to run the code.
  5. Enter the information of your API connection.
  6. Done!

Windwos Version

Service Principal

How to use:

  1. add file Windows Executable Folder/.env
  2. revise .env file to changet to your service princial info and save it
    TENANT_ID=XXXXXXXX
    CLIENT_ID=XXXXXXXX
    CLIENT_SECRET=XXXXXXXX
    SUBSCRIPTION_ID=XXXXXXXX
    OBJECT_ID=XXXXXXX
    
  3. Double click to open /Windows Executable Folder/main.exe to run your app

Troubleshooting

For MacOS version:

How to pack MacOS/ code to excutable file (.app)?

please go to /MacOS, adding .env file include your service prinicpal credential, and pip install py2app in your environment and run script below

$ python setup.py py2app -A # rebuild your application

or follow this reference: https://zhuanlan.zhihu.com/p/454550005 from zhihu by @风影忍着

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published