Moodle 2.2 and oauth web app client Id not working - oauth-2.0

Trying to setup Moodle 2.2 with Google Drive Repository so Moodle students can upload their Google Docs into Moodle assignments.
Using google developers console I have created a Web Application Client ID and added it to Moodle's Google Repository settings.
When File Picker comes up for Moodle users trying to submit assignments Google Drive repository is available. When clicked on they get a Login button. Clicking login button opens an empty folder on Google Drive. They aren't asked for their own login credentials.
Have I made the correct type of API Client ID.
OR is there something else needed?
I did also Save the Consent Screen in the Google Project API.
Thanks in advance,
Shirley

Please check that you have entered the 'Authorized Redirect URI' exactly as shown on your Google Drive plugin config page in Moodle (copy and paste to make sure).
You should also make sure 'Drive API' is enabled on the API page of the Google Dev Console.
If both of these are already set correctly, you could try turning on developer level debugging in Moodle (if it isn't already) and see if that gives you any helpful debug messages when you try again.
Hope this helps.

Related

Codenameone Connect to Google Drive

This may be a dumb questions, but I haven't found an answer after lots of searching. I need to do two things, I need to allow my app to login to google, then save a file the users google drive.
I've found some steps on how to connect to google drive, but either its outdated or I don't have the correct libraries because it fails to compile: https://www.codenameone.com/google-login.html
Any help would be greatly appreciated.
For the login part there are good instructions in this blog post
Another sample of code to login to Google in this demo
You'll need to set the scope of the OAuth2 login to the appropriate Google Drive Scope
For saving files to drive, you should use ConnectionRequest to create the HTTP requests directly to their REST API.
Check the Integrating Google Sign-In into your web app. There's even an video guide explaining the concept.
There's a quick Save to Drive which enables your web site to allow users to save files to their Drive account from an arbitrary URL via their browser. If that's not sufficient enough, you can always check the Uploading Files where you can upload file data by creating or updating a File resource.

Access Not Configured for Google OAUTH Login

I am building a wordpress woocommerce site and am trying to get the users to login using G+.
Everything was going just fine till I changed the plugin I was using and added new redirect URLs to the OAUTH 2.0 Client ID.
Now the users get the error:
Access Not Configured. Google+ API has not been used in project
1033299751186 before or it is disabled. Enable it by visiting
https://console.developers.google.com/apis/api/plus/overview?project=1033299751186
then retry. If you enabled this API recently, wait a few minutes for
the action to propagate to our systems and retry. Please notify about
this error to the Site Admin.
Any help would be appreciated.
Thanks
You need to go to google developer console as it says under the project 1033299751186 and enable the Google+ api.
Your project needs to have each of the different APIs enabled that it needs to access.
Look for API manager -> Enable APIs (its a tab at the top)

Authentication using Google OAuth2 from MVC5 Website Failing (GetExternalLoginInfo always null)

I’m following these instructions to create a simple MVC5 website that allows external authentication using Google and Facebook via OAuth2:
http://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-on
I'm using Visual Studio 2015 Professional, targeting .Net 4.5.2, and all my nuget packages are up to date with the latest stable builds (as of 08/18).
Additionally, my project’s been set up to use https/SSL throughout.
I’ve got to the section ‘Creating a Google app for OAuth 2 and connecting the app to the project’ and have created a sample Web Application project in the Google developer console, with the Google+ API enabled - my list of enabled APIs are:
BigQuery API
Cloud Debugger API
Debuglet Controller API
Google Cloud Logging API
Google Cloud SQL
Google Cloud Storage
Google Cloud Storage JSON API
Google+ API
... basically the default ones with Google+ added.
I’ve added the Authorized redirect URI (https://localhost:44300/signin-google) Authorized Javascript origins (per previous with /signin-google removed) and to the Google project. I’ve also set a product name in the OAuth Consent Screen (but nothing else apart from my email).
I’ve not touched the generated code in the solution, other than to do the following:
In Startup.Auth.cs, uncomment the app.UseGoogleAuthentication section and add the client ID and secret from the Google project (Credentials section)
app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
{
ClientId = "xxxxx.apps.googleusercontent.com",
ClientSecret = "xxxxx"
});
Added Session["Workaround"] = "workaround"; to AccountController in the Post version of ExternalLogin
So I run the application and attempt to login via Google (using the button that appears on-screen). I get taken to enter my Google credentials, which I do successfully. However, on returning to my application what I’m seeing is:
The querystring returned from Google has error=access_denied attached to it (confirmed via Fiddler)
(Consequently?) the call to AuthenticationManager.GetExternalLoginInfoAsync(); in AccountManager always returns null, and I’m redirected to the login page again
I therefore never get the chance to associated the Google login with my application
I’ve also noticed in the Google developer console that there are zero default quota requests, and zero sign-in quota requests in the Google+ API usage section (even though I’ve been hammering this over the last couple of days).
I don’t know what to try next. I've taken a tour of the web looking at this and almost everything I’ve read has said that enabling the Google+ API, and/or setting a placeholder in the session should solve this, but neither option has worked for me.
Any ideas welcome.
Thanks
fiveeuros
So - I should have mentioned that I'm doing this at work, and sitting behind my corporate firewall.
Because this is what's causing the issue.
Further examination of the Fiddler logs showed a whole bunch of 407 Proxy Authentication Required responses.
So I deployed the app to Azure without making any code changes (I did change the google credentials to add the Azure URIs), and it worked straight up.
There are a bunch of other things to workaround with the proxy (remote debugging the Azure app, or connecting to the Azure database from my local SQL Server), but they're for me and the firewall team to work out. What I'm doing is really at conceptual stage so I can live with it as it is for now.
//fiveeuros

Google Drive as a backend server without asking user to login

I am trying to build an iOS application that all users sharing the same google drive account. All users will access the same account to download content only. I am the only one who is uploading content to google drive on web. For this case, is it possible to skip the login and auth process for the user? It would be great if I can have the users directly download the content, and hopefully make the login and auth implicitly done by code.
Please help. Thanks in advance.

Google Drive API for Chrome packaged app

I was following quick start example for getting oauth setup for my packaged app.
https://developers.google.com/drive/quickstart-js
In order to get the client id, they put localhost port in redirect uri field, but since I am not dealing with any local server, what should I put in there to get the client id? I don't have any url set all I have done is created a manifest file, background file and loaded the unpacked extension to start with. My packaged app just needs Google Drive api to access files from it. I am just confused in getting the client id part. Any help will be greatly appreciated
Despite what the Chrome Identity API documentation says, it is possible to get a client ID through the Google APIs Console. Choose installed application as the application type and Chrome application from the installed application type. Then enter the your application's ID from the Chrome extensions menu.

Resources