Omniauth-slack scope error - ruby-on-rails

I would like to receive both a webhook url and the list of channels but have been unable to with the following scopes:
'channels:read,incoming-webhook' (This only has the single channel that was selected)
'channels:list,incoming-webhook' (This says: OAuth Error: invalid_scope: Invalid scope channels:list)
How can I get this information in one oauth?
Here is another site I used to try to troubleshoot this issue.

channels.list is a method and so you you have to make another 'get' to get this data. Here is an example: https://api.slack.com/methods/channels.list/test

Related

Issue with Graph API in Power automate

I am trying to get all users out of a tenant with power automate.
But when i try to filter out users with userType Member.
I keep getting the error:
Enter a Valid URI ( even tough i am using a valid URI that is used inside the docs)
https://graph.microsoft.com/beta/users?$filter=userType eq 'Member'
Do not specify $filter query in URI but add it to Queries.
Example (not sure if I'm using the same trigger):

Why does this Microsoft Graph request works for most users, but returns "Bad Request - Error in query syntax" for guest users?

Sometimes, I do a request to get the value of several fields for a given user.
Here is an example of such a request that works for a given user(the id corresponds to a user of type "Member"):
https://graph.microsoft.com/v1.0/users/bba8407c-2f05-4e91-b27e-a207689a085f?$select=passwordProfile,aboutMe,accountEnabled,assignedLicenses,assignedPlans,birthday,businessPhones,city,companyName,country,department,displayName,givenName,hireDate,imAddresses,interests,jobTitle,mail,mailboxSettings,mailNickname,mobilePhone,mySite,officeLocation,onPremisesImmutableId,onPremisesLastSyncDateTime,onPremisesSecurityIdentifier,onPremisesSyncEnabled,passwordPolicies,pastProjects,postalCode,preferredLanguage,preferredName,provisionedPlans,proxyAddresses,responsibilities,schools,skills,state,streetAddress,surname,usageLocation,userPrincipalName,userType
No problem here. But doing the same request for another user of type "Guest", I get an Http 400 (bad request). Here is a request that fails, even if the format is exactly the same:
https://graph.microsoft.com/v1.0/users/3e3fac9d-ad76-4f9a-b86c-b4691a524572?$select=passwordProfile,aboutMe,accountEnabled,assignedLicenses,assignedPlans,birthday,businessPhones,city,companyName,country,department,displayName,givenName,hireDate,imAddresses,interests,jobTitle,mail,mailboxSettings,mailNickname,mobilePhone,mySite,officeLocation,onPremisesImmutableId,onPremisesLastSyncDateTime,onPremisesSecurityIdentifier,onPremisesSyncEnabled,passwordPolicies,pastProjects,postalCode,preferredLanguage,preferredName,provisionedPlans,proxyAddresses,responsibilities,schools,skills,state,streetAddress,surname,usageLocation,userPrincipalName,userType
So the request syntax is identical, the only part that changes is the user id. But the second one returns "Bad Request - Error in query syntax". What is going on here? Why can I not do that request for guest users?
I can reproduce this problem for any tenant. It never works for any guest user.
Request-id of the failing request: 49e80d99-5074-4404-900f-e1d14889bf2b
it appears that some of those properties are unavailable for guest users. If you want to fetch non-guest users, you can use $filter syntax such as https://graph.microsoft.com/v1.0/users?$filter=userType eq 'Member'

How do I get a users online status via the slack api?

the users active/away status does not appear to be listed here:
https://api.slack.com/types/user
is there another method to query this information that I missed?
Maybe you noticed it by now, but there is a method named users.getPresence in the Slack API.
Example of querying the API, given that you have created a token (token=xoxp-313xxxxxx-313xxxxxx-313xxxxxx-xxxxxx) and you are looking for the user with the ID U03xxxxxx.
curl -X POST https://slack.com/api/users.getPresence
--data "token=xoxp-313xxxxxx-313xxxxxx-313xxxxxx-xxxxxx&user=U03xxxxxx"
Response:
{"ok":true,"presence":"away"}
Note that you can get user ids, with the method users.list or users.info.
REF: https://api.slack.com/methods
Currently there's the status key on user objects returned from
https://slack.com/api/users.info
I think the most easier way for this > get all user presence status (up to 1000 users) quickly is the users.list method.
https://api.slack.com/methods/users.info
https://slack.com/api/users.list?token=xoxp-173888888-XXXXXXXX-YYYYYYYY-ZZZZZZZZ&presence=true&pretty=1
Please don't forget to read the documentation, sometimes the limit at 200.

Google contacts API 401 error RestClient::Unauthorized

I want to retrieve the Google contacts from a user in Ruby on rails using Restclient, but I every time I tried, I face a Restclient 401 Unauthorized error on my query line. I assume that my query is wrong or missgin something, but I didn't find anything usefull in the Google Contact API doc.
Any idea ?
Here's my scope
scope = 'https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile+https://www.google.com/m8/feeds/contacts/default/full/+https://mail.google.com/mail/feed/atom/+https://www.googleapis.com/auth/calendar'
Here's my method I call with a freshly received access_token
def import_google_contact(user_email, access_token)
r = RestClient.get "https://www.google.com/m8/feeds/contacts/#{user_email}/full?access_token=#{access_token}"
...
end
Which is weird since I manage to get the user email just before in the same method using this request
r = RestClient.get "https://www.googleapis.com/oauth2/v2/userinfo?access_token=#{access_token}"
I discovered I didn't put the right parameter in the scope to request contacts data? I replaced it by
https://www.google.com/m8/feeds
This is weird because Google accepts a wrong one during the authorization process

Koala - Create tab in facebook (rails)

I want to create tabs on FB.
I have this code:
#graph = Koala::Facebook::API.new(Client.find(session[:id_client]).oauth_token)
#graph.put_connections("4154829881847172/tabs","POST", {:access_token => "AAABwdtYjsyoBAMcg558a4FYnZBkZBUiPKmcWWssssWoNZC2yjqE43ghoR9uTiFIhT3ErkQYx45RrrPeOD0ZCvFgnmRIUh9lqRUw5KIlWwxtRW3GvbIEUWp0yB2", :app_id => '1236553701115690'})
But I have a problem
-> OAuthException: (#210) Subject must be a page.
Is 4154829881847172 the correct ID for the page you're trying to add the tab to?
And are you definitely using the page's access token? (as opposed to a user access token for the page admin)
Either of those being incorrect means you're passing a something-other-than-a-page's ID in place of the Page ID
This did not work for me as well. And I think the reason is http://developers.facebook.com/bugs/194192344040832/. Running this on over Graph API Explorer gives the same result.
But I did using the following way
#graph = Koala::Facebook::GraphAPI.new("user_access_token")
#newgraph=Koala::Facebook::GraphAPI.new("page_access_token")
#newgraph.put_connections("me","tabs", {:app_id => 'your_app_id'})
You basically make a graph object with the page access token and then run the put_connections method.

Resources