Python Forum
Python & MSGraph - Learning to Walk
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python & MSGraph - Learning to Walk
#1
Smile 
Hello Pythoneers,

I am trying to create a console application where it will ask for AAD User email address, validate if exists and if it does not exist add the user into two Azure AD groups, do some validation as well. I have registered the application in Azure, I have the application id, client id, client secret and the respective permissions.

I would like to have some guidance in be able connect successfully. I have python installed and I am using Visual Studio Code

One more thing I did create a code using Azure PowerShell, but the thing is that I need to create an executable.

I know there are tons of stuff out there, but I try to make it work in my environment and most of the time errors out.

Thanks for your help,
Reply
#2
Don't know what Azure is, must be some kind of cloud-based database.

If you want to validate the email, you probably want a password too, I think. Anyone can get an email address alone.

I think this kind of login will happen on a webpage form, and interaction with the user will be via webpages, so why not use PHP?

First, you look for the email in the db table, if the email is found, check the password. If that is OK, let the user in.

A very basic PHP login script:

Quote:<?php
//start new PHP session array
session_start();
//check if login form is submitted
if(isset($_POST['login'])){
//assign variables to post values
$email = $_POST['email'];
$password = $_POST['password'];
//include our database connection
include 'conn.php';
//get the user with email
$stmt = $pdo->prepare('SELECT * FROM mydbtable WHERE email = :email');
try{
$stmt->execute(['email' => $email]);
//check if email in this instance exists
if($stmt->rowCount() > 0){
//get the row
$user = $stmt->fetch();
//validate the password with $user[password]
if(password_verify($password, $user['password'])){
//action after a successful login
//for now just message a successful login
$_SESSION['success'] = 'User verification successful';
catch (PDOException $e){
$_SESSION['exception'] = $e->getMessage();
}
// if email and password are OK, go to the desired webpage
header('location: mywebpage.html.php');
exit();
}
?>


But I would prefer a Linux server!

Also, you should show what code you have tried here, along with the error messages you get, or how can the people here help you?
Reply
#3
Unfortunately PHP will not work,,the main purpose of what I am looking for is if I am not available and a laptop failed. The end user will ask the person in charge if I am not availble to execute the executable application (.exe), it will run, will ask for email address and in the background will process what I said in the thread...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  EasySNMP Walk/BulkWalk pylance 3 2,098 Nov-29-2021, 12:00 PM
Last Post: pylance
  How to sort os.walk list? Denial 6 11,581 Oct-10-2020, 05:28 AM
Last Post: Denial
  os.walk question DPaul 2 2,347 May-31-2020, 02:08 PM
Last Post: DPaul
  os.walk(Path("path_string")) giving error Kumarkv 4 3,883 May-10-2020, 08:46 AM
Last Post: snippsat
  os.walk does not see files that are in the folder kiton 1 3,031 Jan-21-2020, 07:26 PM
Last Post: micseydel
  print notifcation when enter new directory os.walk() evilcode1 3 2,630 Jun-20-2019, 08:19 PM
Last Post: evilcode1
  Animating Random Walk Excelsiscelia 2 5,231 Nov-24-2018, 08:53 AM
Last Post: Excelsiscelia
  Python3 & os.walk while_e_coyote 2 3,453 Aug-24-2018, 07:32 PM
Last Post: while_e_coyote
  how to test if an object came from os.walk() Skaperen 3 3,207 Jan-10-2018, 03:05 AM
Last Post: Skaperen
  Question about os.walk() behaviour dfkettle 3 4,386 Jan-07-2018, 06:52 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020