I downloaded the example:
https://dev.office.com/Getting-Started/office365Apis?platform=option-android#register-app
clicking on send button throws this error:
RetrofitError: 404 Not Found
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "Bearer access token is empty.",
"innerError": {
"request-id": "951626d4-0168-4b58-a78a-1fdd3bd322f2",
"date": "2016-04-29T18:34:05"
}
}
}
It looks like perhaps you did not register your app before downloading the sample. The readme instruction in the sample should walk you through registering and configuring an app, at which point the login should succeed and you will get a bearer token.
You are missing an access token. From https://msdn.microsoft.com/en-us/office/office365/api/discovery-service-rest-operations:
Discovery Service operations
Initial sign in
This brings the client to a web page where the user enters account information. It returns the endpoints needed to continue with Discovery Service. This is used the first time a user tries your application. It tells your application:
what cloud the user belongs to
where the app can send the user to log in
where to go to get a token
you can continue reading it on the official site.
Related
I have requirement to get the person ID from the linkedin API
https://api.linkedin.com/v2/clientAwareMemberHandles?q=handleString&handleString=test123#gmail.com
but receiving response below
{
"serviceErrorCode": 100,
"message": "Not enough permissions to access: GET-handleString /clientAwareMemberHandles",
"status": 403
}
I have the application permissions in the application r_liteprofile/w_member_social/r_emailaddress
Additionally when I requesting a access token I send these three as scope parameters.
Appreciate your guidance.
This response is from linked in api and not from API manager. Basically, this means that the call from api manager to LinkedIn api does not have a token with the correct permission.
The token which is generated by API Manager is only for authentication with api manager. If the backend server expects a token as well, you should send that particular token in the request from API-M to the backend.
You can achieve this by adding a meditation sequence to your api. Follow the example below.
https://medium.com/#menakajayawardena/wso2-how-to-using-oauth2-protected-back-ends-with-api-manager-5d7e234c61c
https://api.twitter.com/1.1/account_activity/all/prod/webhooks.json?url=https://test.com not working
I have followed all steps to create a new application and getting consumer key, secret keys and also token details and try to create webhook via postman. I am getting follwing error
{
"errors": [
{
"code": 32,
"message": "Could not authenticate you."
}
]
}
I have tried delete and get methods for webhook and it is working fine.
They probably goofed in their example. You just need to move the url parameter from the query string to the form data. Use the x-www-form-urlencoded body.
Also - if you leave the nonce and timestamp blank, then Postman will auto-generate them for you.
enter image description here
I've created a SpringBoot application which authenticates users against my company's Azure Active Directory server using OAuth 2.0
Now I'd like to display the User's profile picture.
The first way I went about this was to naively embed the graph API url to the user's profile picture in an IMG tag, assuming that the browser's cookies would implicitly provide authentication for the logged-in user:
<img src="https://graph.microsoft.com/v1.0/me/photos/48x48/$value"/>
but this results in a 401 error:
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "Access token is empty.",
"innerError": {
"request-id": "71fe8fc9-e8d2-4f2e-950d-04e7d9fa64e6",
"date": "2018-09-24T07:08:50"
}
}
}
what's the best way to get the User's profile picture after AD/OAuth authentication - I'm happy to do this either by the client-side or server-side, and ideally I'd like to know both approaches
You could do it client-side, but you'd need to acquire an access token with ADAL.JS/MSAL.JS and then request for the file and set it as the content of the img element via JavaScript.
Server-side is probably easier to implement, point the img to an HTTP route in your back-end, acquire an access token, call the API, and return the bytes of the image as a result from the route.
I am trying to make a very simple app with spring social, the app is not for public. What I am trying to achieve is to post to my wall or to the page that I administer.
Trying to ask facebook for access to manage_pages permission they denied because as they said "You do not need to request these permissions because your blog or CMS is integrated with an app that you admin. As an App admin, you can already access these permissions and post to your timeline or a page you admin. You can provide access to additional users by adding them as developers of your App."
Now in the code. I altered a bit spring social showcase example. And my case is as follows:
1) I login to facebook through my app
2) Trying to get the number of pages that I administer
3) Post to my wall.
For step two I am using this code:
if (facebook.pageOperations().getAccounts() != null) {
System.out.println("SIZE OF ACCCOUNTS IS: " + facebook.pageOperations().getAccounts().size());
}
The size of accounts is always 0. So this means that although I should be able to post to the pages that I am administrator I can not even see them. Am I correct?
For step three now:
facebook.feedOperations().updateStatus("I'm trying out Spring Social!");
facebook.feedOperations().post(new PostData("me").message("I'm trying out Spring Social!")
.link("http://www.springsource.org/spring-social", null, "Spring Social", "The Spring Social Project", "Spring Social is an extension to Spring to enable applications to connect with service providers."));
System.out.println("FEED POSTED");
both of those attempts fail with the following exception:
org.springframework.social.InsufficientPermissionException: Insufficient permission for this operation.
Could someone help please?
It seems like you have not asked/granted the permissions that you need during login. The first thing that you need to do is implement login and ensure sure that you include the correct scope i.e. permission (manage_pages) during login. Since your requirements also include publishing, include these permissions publish_pages and/or publish_actions depending on whether you want to publish as a page or yourself. e.g. if you are using the JS SDK, it would look something like this:
FB.login(function(response) {
// handle the response
}, {scope: 'manage_pages, publish_pages, publish_actions'});
Once you do this, on logging in, you will be prompted if you want to grant these permissions. On granting, your access token will contain these permissions and you will be able to make a call to /me/accounts which will give you a list of pages that you admin and their respective access tokens. It will look something like this:
"data": [
{
"access_token": "CAACEdEose0cBAAy...",
"category": "Food/Grocery",
"name": "Page Name",
"id": "1234567890",
"perms": [
"ADMINISTER",
"EDIT_PROFILE",
"BASIC_ADMIN"
]
},
...
]
If you want to publish as yourself, then you can continue using the current user access token. Else if you want to publish as a page, grab the page access token from the response above and use that to make the POST request against the page id.
And if you are creating an app for yourself and not for the public, then you do not need to submit these permissions for review provided you are an admin or have some role in the app.
You might be able to find some more context here.
I followed an instruction fro a user here, about allowing users to automatically login using their facebook account in the app that i am creating . But, i am having errors.
<%
String fbURL = "http://www.facebook.com/dialog/oauth?client_id=651066068265632&
redirect_uri=" + URLEncoder.encode("651066068265632") + "&scope=email";
%>
this is the new error that I got:
The redirect_uri URL must be absolute
also:
Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
I tried to get a new example from Graph API, and i downloaded the whole project, but this is the error i am getting::
{
"error": {
"message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
"type": "OAuthException",
"code": 191
}
}
what should i do?
Please use the instructions on https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/ or use already existing interfaces like RestFB or Spring (https://spring.io/guides/gs/accessing-facebook/)