Remove all phones from Google Directory User - rest

I am attempting to remove all phones from a Google Directory User, using the Admin Directory API directory_v1 > directory.users.update.
I am sending the following request body:
{
"phones": []
}
but this seems to have no effect.
How can I achieve this?

Set it to null:
{
“phones”:null
}
See the note all the way at the bottom of the API documentation you linked to in the ‘update’ section.

Related

Is it possible to create a user project (V2) with a github app?

I am trying to create a projectV2 with Github's Graphql API, through a Github App, because they have deprecated their classical projects, and if you try to create a project in a repository that doesn't have one previously associated Github doesn't allow it. There's a workaround to do it anyways, but it's a workaround that's probably gonna be removed soon..
I cannot find any official docs/posts/discussions describing how to do this (effectively, at least) so if someone has a resource to offer, that would also be great.
when I try to do the following mutation with an app created just with this purpose in mind, with every permission enabled (it would not need every permission to add a project for sure), the API responds with an error of type: "FORBIDDEN" and message: "Resource not accessible by integration"
(sent to api.github.com/graphql, with a content type and an Authorization header)
mutation {
createProjectV2(
input: {title: "V2 project related to test repo created by a bot", ownerId: "MY_USER_ID", clientMutationId: ""}
) {
__typename
projectV2 {
creator {
login
resourcePath
... on Bot {
id
login
}
}
...ProjectV2Fragment
}
clientMutationId
}
}
fragment ProjectV2Fragment on ProjectV2 {
title
id
creator {
login
__typename
resourcePath
}
}
If I try to do it authenticated as myself with a (classic) personal access token, I can create it without any problem, but when I try this with the authentication that I got from the github App it won't let me.
I know the auth of the Github App is valid because I can create projects related to the organization I used to create the bot.
Any ideas?

DropboxPaper API "paper/docs/create" doesn't work

I'm trying to create new DropboxPaper document in my account [email address redacted],
I'm use official Api and try to create file by "https://api.dropboxapi.com/2/paper/docs/create", the returned result is:
{
"error_summary": "insufficient_permissions/.",
"error": {
".tag": "insufficient_permissions"
}
}
Somebody know what's is wrong? Please help me)
[Cross-linking for reference: https://www.dropboxforum.com/t5/API-Support-Feedback/Paper-API-Create-Paper-Document/m-p/375961/highlight/true#M21093 ]
It sounds like you're probably using a new Dropbox account, so the Dropbox Paper functionality is only available in the Dropbox filesystem, and not via the legacy Paper API endpoints. You can find more information here:
https://www.dropbox.com/lp/developers/reference/paper-migration-guide

Google Sign-In with Passportjs not getting authenticated

I'm using Sails with Passport for authentication. I'm using passport-google-oauth(OAuth2Strategy) and passport-facebook for enabling Google Sign-in.
I'm not too well-versed with Passport, so pardon me if this is a rookie question. I've set up login via Facebook and it works just fine. With Google, I do receive an authorization code after allowing access to the app, but the I'm eventually not authenticated. I'm guessing the same code should work for both Facebook and Google since the strategies are both based on oauth2.
I'm not even sure what code to share, since I'm using the auto-generated code from sails-generate-auth, but do let me know if there's anything else I can share.
Any ideas on why this might be happening? The app is locally hosted but that's unlikely to be the problem since I am getting to the authorization stage anyway.
I faced the same problem and it was located here in in api/services/passport.js:
// If the profile object contains a list of emails, grab the first one and
// add it to the user.
if (profile.hasOwnProperty('emails')) {
user.email = profile.emails[0].value;
}
// If the profile object contains a username, add it to the user.
if (profile.hasOwnProperty('username')) {
user.username = profile.username;
}
// If neither an email or a username was available in the profile, we don't
// have a way of identifying the user in the future. Throw an error and let
// whoever's next in the line take care of it.
if (!user.username && !user.email) {
return next(new Error('Neither a username nor email was available'));
}
The Google service was not returning a profile.username property.
Because of it, the user is not saved in the database and cannot be authenticated. Then the passport callback receives an empty user, so the function that handles errors is fired and the user is redirected to the login page.
This change allows to use the displayName property as the username:
// If the profile object contains a list of emails, grab the first one and
// add it to the user.
if (profile.hasOwnProperty('emails')) {
user.email = profile.emails[0].value;
}
// If the profile object contains a username, add it to the user.
if (profile.hasOwnProperty('username')) {
user.username = profile.username;
}
/** Content not generated BEGIN */
// If the username property was empty and the profile object
// contains a property "displayName", add it to the user.
if (!user.username && profile.hasOwnProperty('displayName')) {
console.log(profile); // <= Use it to check the content given by Google about the user
user.username = profile.displayName;
}
/** Content not generated END */
// If neither an email or a username was available in the profile, we don't
// have a way of identifying the user in the future. Throw an error and let
// whoever's next in the line take care of it.
if (!user.username && !user.email) {
return next(new Error('Neither a username nor email was available'));
}
You could also use the profile.id property because profile.displayName is not necessarily unique (ie: two Google accounts can have an identical displayName). But it is also true accross different services: a Twitter account could also have the same username than a Facebook account. If both register on your application, you will have a bug. This is a problem from the code generated by sails-generate-auth and you should adapt it with the behavior that you want.
I will propose a PR if this solution works for you too.
Alright, so this ultimately turned out to be a known issue with the API.
TL;DR: Enable the Google+ API and the Contacts API as mentioned here. (The Contacts API isn't required, as #AlexisN-o pointed out in the comments. My setup worked as desired with Contacts API disabled. This obviously depends on what scope you're using.)
I believe it's not a nice way of failing since this was an API error that was prevented from bubbling up. Anyway, I dug into passport.authenticate to figure out what was going wrong. This eventually calls the authenticate method defined in the package corresponding to the strategy (oauth2 in this case). In here (passport-google-oauth/lib/passport-google-oauth/oauth2.js) I found that the accessToken was indeed being fetched from Google, so things should be working. This indicated that there was a problem with the requests being made to the token urls. So I ventured a little further into passport-oauth2/lib/strategy.js and finally managed to log this error:
{ [InternalOAuthError: failed to fetch user profile]
name: 'InternalOAuthError',
message: 'failed to fetch user profile',
oauthError:
{ statusCode: 403,
data: '{
"error": {
"errors": [{
"domain": "usageLimits",
"reason": "accessNotConfigured",
"message": "Access Not Configured. The API (Google+ API) is not enabled for your project. Please use the Google Developers Console to update your configuration.",
"extendedHelp": "https://console.developers.google.com"
}],
"code": 403,
"message": "Access Not Configured. The API (Google+ API) is not enabled for your project. Please use the Google Developers Console to update your configuration."
}
}'
} }
This was the end of the hunt for me and the first result for the error search led to the correct answer. Weird fix though.

Chrome extension - For facebook to block 'seen at' in Messages

I was going through a few Chrome extensions that claim to disable the 'Seen At' feature of facebook messages.
(source: thetecnica.com)
How can this be achieved from a Chrome extension considering the fact that the extension gets executed in its own isolated world?
I understand that this can be achieved using the Graph API but was wondering how this works with just UI?
If you want to Disable "seen" from extension, you have to Block just One URL: https://www.facebook.com/ajax/mercury/change_read_status.php
So after that read status will be blocked.
you have to run script on background:
"background": {
"scripts": [ "background.js" ]
}
And the background.js files would be following:
chrome.webRequest.onBeforeRequest.addListener(function(details) {
return {
cancel: true
}
}, { urls: ['*://*.facebook.com/*change_read_status.php*'] }, ['blocking'])
you could use adblock or adblock plus addon or extensions for your browser(or any other extension which can block script file)
suppose if you will use adblock
then go to adblock icon
filter preferences
custom filter ->add filter group ->show/hide filter
then add two new filters
1)
ajax/mercury/change_read_status.php$xmlhttprequest
2)
/ajax/mercury/change_read_status.php$domain=facebook.com
thats all now sender cant able to seen that you read his or her message :)
further more also try this video it has step by step guide to Hide "Seen On" feature of Facebook Messages or chat
https://www.youtube.com/watch?v=QtG75oISKkA
after that you will able to understand how you can read anyone message secretly so that sender cant able to seen that you read his or her message :)

Need to know whether Google Group is Admin managed or user managed in google apps domain?

I am using Google Apps Provisioning API to play around with google apps domains group settings. I have got the list of the all the groups in a domains but I need to know whethet a particular group is User-Managed or Admin-Managed.
I cannot see any method to get that information. I would need some help here if anybody knows about this. Thanks :)
With Google Apps Script, you could get the Owner list using getAllOwners(), and check to see if the owners of the group are admins. Something like:
function isAdminManaged(groupName){
var groupOwners = GroupsManager.getGroup(groupName).getAllOwners();
for (var owner in groupOwners){
var userName = groupOwners[owner];
if(UserManager.getUser(userName).getIsAdmin()){
return true;
}
}
return false;
}
The provisioning API has an undocumented flag you can specify when retrieving all groups with this call:
https://developers.google.com/google-apps/provisioning/#retrieving_all_groups_in_a_domain
if you append ?skipUserCreatedGroups=True to the URI, as in:
https://apps-apis.google.com/a/feeds/group/2.0/example.com?skipUserCreatedGroups=True
then only admin-created groups will be returned. If your group isn't returned by this API call, then you know it's user managed.
Not highly efficient for checking just one group but it gets the job done.