Unable to send email to various users using MS Graph API - php

We want to send email to logged in users in our Drupal application. We are authenticating using AAD and our site is hosted in Azure app service.
we have a generic service account with a mailbox attached and we would like to notify the logged in users in case of any event using MS graph API and O365 connections.
Can we please get some guidance in this respect.

You can use the Graph API to send emails from your service account. Where you are going to have a problem is with identifying logged in users. An AAD token will be valid for your site even if the user originally signed in somewhere else, so logging signins isn't foolproof. Unless your users specifically sign out, the token will also be valid past when they stop using the site.
If you wanted to go down this road, then doing some logging of user actions and then sending the email to users that have been active within X amount of time might be an option.
If your goal is to notify users and you don't need an email specifically, then you might want to looking into using websockets or something similar to send notifications to the users within their browser.

Related

Sign into existing Laravel back-end with Parse

I am interested in expanding a Laravel 4.2 web app into the realm of mobile apps, allowing simple things such as the ability for existing users to sign in (but not sign up) and receive push notifications (simple at first for beta testing). I am very intrigued by Parse.com for their push notification capability but do not want to have to manage two sets of users - Parse and Laravel. Further, this app will be locked down to subscribers - it cannot be a free for all when it comes to user registration.
On the feature list for Parse Core it mentions connecting users via "traditional logins" but I cannot find an example of this anywhere. By "traditional login" do they mean sending a username and password to a remote back end? Or is that their way of referring to logging in with Parse users? Is it possible to connect Parse to a remote API such as my Laravel project (something along the lines of sending POST data with username and password and returning an auth token)?
I'd appreciate any advice on this or links to tutorials/documentation/etc. I have searched quite a bit and cannot seem to find anything.
Thanks!
You can use any of the SDKs to login a user either using a username/password or using Facebook.
Android login
iOs login
REST login
I would suggest you log the user in on the client device so that their device is registered to allow push notifications.
You can also use the REST API in your server code to do other things, such as creating the User and sending push notifications.
You can use Roles to limit things, e.g. create a "Subscriber" role and set permissions based on that Role.

Google OAuth to remember chosen account

I've implemented Google OAuth 2.0 login on a site that I'm working on. It works fine, except in situations when the user is logged with two or more different accounts on the same browser. It's asking him to choose which one he want's to use. But it's asking the user every time to choose the account. Is there a way to remember this, so the user can choose the account only the first time and later automatically to log him with that account?
You can put hd=domain.com parameter in the request to Google, but that only helps if the two logged accounts are from different domains and it can than log the user in with #domain.com account.
I read somewhere that you can send user_id account as a parameter to Google (I guess that would be the email address), but in this case I don't know the users email address before he logs in.
I think this behavior is the same if you use OpenID.
I'm using Google's PHP OAuth library.
Thanks,
Andrej
Google should have a cookie set that enables OAuth applications to tell what account to currently use.
If you know the email address you want to log in with, you can use the login_hint parameter and they won't see the account chooser. See https://developers.google.com/accounts/docs/OAuth2Login#sendauthrequest

Update Facebook Status via SMS application

We have a request from a client to update facebook status/comments through a text message.
Here is the scenario.
The SMS carries the fb Username,Password and the status/comments and this will goes to a SMS Gateway. Then the USername,Password and the status/comments come to our application and our application should facilitate to update the status and comments on the fb account.
Is there a method to authenticate the user through a SMS (Auth Dialog box) or is there any other method to update status/comments on fb through a sms. This is a PHP application.
Why don't you ask your user to create an account on your site and authorize your Facebook registered App to access his timeline? He would also register his phone number on your site and get a short numeric unique ID.
Then he can just send an SMS and when you detect a phone number or the numeric ID in a SMS, you post with the Facebook API which you are authorized for.
Sending Username and Password via SMS is not a great idea. A numeric ID of the phone number itself is much safer.
PS: I'm not using FBAPI but this is how it's supposed to work, from what I heard.
it is not possible to authenticate using username and password.
you should ask your users to create new application on their profile or authenticate first via your website in order to grant you an access.
after obtaining application_key and application_secret you can manipulate with user's account using these pairs.
please refer to facebook's developer zone to get more details on how fbapi works.

Programmatic login to Google Data API

I'm building an application which will basically be an interface for my Google Finance account. Several people will use. I have just started to research on how to do this, and one thing that immidiately seems like a hurdle is Google's oAuth system, seemingly designed for the case where each user logs into his account himself.
The usual proceeding as I understand it is that from my web application, the user gets redirected to Google's page, where they enter their information, and then are sent back. I will wind up with an authorized token that I can use to pull the data that I want.
BUT, now, as my application will ALWAYS and ONLY pull data from my account no matter who is logged in to my application, I need to always be authorized and it needs to happen programmatically without the user ever knowing.
Is this possible?
If this is designed to be an interface to YOUR Google Finance account that several people will use, then OAuth is probably not the answer you're looking for.
OAuth would allow your app to pull information from your users' Google Accounts, whereas ClientLogin would allow your application to pull data from a single account.
Check the Google Finance API for more details and examples:
http://code.google.com/apis/finance/docs/2.0/developers_guide_protocol.html#ClientLogin

Sending Facebook messages through their API - possible?

I'm building a web app for a client where members of general public can create an account. Client would like to be able to use my app to send Facebook messages to those members.
Note that my app is a standard LAMP site and NOT a facebook application, nor is there the desire to create one; delivering messages to members' FB inbox is the only goal.
Is this possible, using the FB API or any other way?
In short the answer is no. Facebook do not give you the ability to do this to prevent spam. You could post to all of your user's feeds however?
What you would need to do is:
Register facebook app to get access to FB API. You don't need to have actual facebook app, just use received API key on your standalone site.
Create authentication process on your site so users would be able to connect with your site through facebook.
Ask users for additional extended permissions during authentication to access their email, as it is not something that could be accessed without user's explicit permission.
That's the bare minimum for this task.

Categories