-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XOAUTH2 google apps for domains #10
Comments
Hi Matt, can you share the page where they announced/documented this change ? |
Hi Nicolas This is going to be a bit long winded, but every time I've done anything with google that has been the case. I'm going to paste in a list of actions I did in order to try and get a valid access token to use with your gem. Underneath that will be the response from google. Im more than likely doing something stupid, so if you can see it, please let me know. BTW, we've used your gem for years with XOAUTH1 and our google apps for Education service, worked like a charm. My step by step guide
You should now have a Client ID, a Client secret and 2 redirect URIs
Follow the instructions on the screen, and you should now have an access Token is:
Click Security -> Show more -> Advanced -> Manage API Client access Googles response "The steps you use are very good and exactly what you should be doing, other then the third party script you are using for generating of the token. Although I review it and it seems fine to me, I can't advise you to continue using it, however, this is not where I saw a problem, but keep in mind that the script is not supported by us. At the very end, you explained how you manually add the scopes within the Admin Console > Security, which is correct if you were using the old authentication methods from oAuth 1.0, however, this authentication method was deprecated and currently, we are using 2.0, which has different ways of functioning. You can find how to use 2.0 OAuth in this official article: https://developers.google.com/identity/protocols/OAuth2UserAgent" |
I should double-check cdaea3f then. |
Hi Nicolas I'll try and do it with a normal gmail account now, it's unlikely to work though as the system that is doing this call is highly tied in with google apps, so it may not be possible, I will try though. I'm not totally convinced that the google support is correct here, and I think it may be a problem with the account that I create the project with in the developer console. It is a super admin in the google apps domain though. |
Bit more information I followed the instructions on this page I then threw this at it curl -H "Authorization: Bearer ya29.ZAGeGYrMRCcJ_1abz5LoH9lsZbILm2XNdLY7hODUqtmZcwdq8aagOs05d3uYdBJzrSKyiwWRRTGY-Nh4Q" https://www.googleapis.com/gmail/v1/users/me/threads That was fine But if I changed the 'me' to a google apps users email address, it failed. "domain": "global", Bear in mind I'm a fully fledged admin in that domain. Found this about this topic That does say that using imap is ok though. I have a deep seated fear of working with google, the documentation drives me insane. |
Matt, |
Well I'm not sure anymore. I guess the problem happens because you try to use scopes. In any case, I never tried that. Thus you should try a library in another language to know if gmail_xoauth really has a bug. |
Hi Nicolas, thanks for getting back to me. I'm pretty sure that the gem is fine, but it's the process that I'm following trying to setup the access that I've messed up, or maybe I'm misreading some documentation or using the wrong token. I'm going to write up a step by step account of what I'm doing, and include the code I'm using to try and authenticate using my google admin account, no delegation involved then, and then get back to you. Sorry for the confusion of putting some work I did on the gmail API up here, I realise this isn't using that but it was the delegation issue that made me think it could be connected to my account, not the gem. If you've got a blow by blow account of how to setup the connection between project in the google developers console, and the Google Apps domain, especially the options you take when creating this connection, that would be absolutely fabulous. |
Hi Nicolas I'm following google's docs here in this process.
require 'gmail_xoauth' That works, happy days!! If I change the email address to a students email address that is in our google apps for domains, it doesn't work. 4 The next thing I need to do is to tell our Google Apps that this project is allowed to access all users email data. Once that is done, I still cannot access the other users mail count, invalid credentials error. Recently a google representative told me that step 4 was for Oauth1 authentication, and not to do that any more as it's changed. If you click on learn more on that page, it takes you to here which also states that it's deprecated. https://developers.google.com/accounts/docs/RegistrationForWebAppsAuto?csw=1 I'll post this up in stack overflow as well, see if anyone else can shed any light on it, but it seems to me the bit I'm missing is telling our google apps domain to trust the project I set up in 1. I'm now looking through this documentation, see if it will help. |
I've asked for some help in the community Nicolas. |
Hi Nicolas After some research and gnashing of teeth I've finally been able to get https://github.com/google/oauth2client to access a students gmail data, using a service account. Here's the code
See how I provide the public key, and also the client_email address from the Service Account that I have given delegation rights to all our users in our google apps domain. Given that information, could you tell me how to use gmail_xoauth to accomplish the same result? As I'm not inputting an access token here, and your code wants an access token, I'm really struggling to work it out. Like I said earlier, it's probably me not understanding something, so any help and advice would be great. Thanks Matt |
Hi Matt, your example uses an HTTP API, but gmail_xoauth only supports IMAP and SMTP. I don't even know if what you're trying to accomplish is possible with the IMAP extended protocol provided by Google. |
Hi Nicolas It looks like it is possible. https://code.google.com/p/java-gmail-imap/wiki/GmailAndXOAUTH2 It would be great if you could port that into this gem. Matt |
Hi Nicolas Is this something your still considering doing or should we start looking elsewhere? Thanks again Matt |
@mjdavies did you manage to get this gem working with imap access for domain-wide delegation of authority? |
Morning all
Can you confirm that this gem works currently with how Google have changed the way you use XOAUTH2?
I can't get this to work, with a valid access token, keeps telling me Invalid Credentials.
I'm currently in a conversation with a google representative about this, any news I get I'll pass on.
Matt
The text was updated successfully, but these errors were encountered: