How to find out that the user's login time has expired in sharepoint with pnp js? - sharepoint

I know when error 403 in a request that's mean user does not have access.
But if the login time expires , again request give error 403.
can you help me?
I looked in other sites but I did not find the answer.

Related

Accessing Quire API: Authorization code expired

I performed some tests with the API (by the way thanks a lot for that ;-)) and I struggle with the following issue: {'error': 'invalid_grant', 'error_description': "The 'code' provided was invalid."} If I run into the manual process to get the authorization code and try with the new one it's work but after test it's doesn't work again. Can you tell me the reasons that can expire this code? In the doc I only see about the token expiration. Is that because my app is in "Unpublished"? Thanks in advance.
You need to refresh the access token when the token is already expired (the token will be expired after 1 hour). For more details, please visit this blog post: https://quire.io/blog/p/Create-Your-Quire-App-with-Quire-API.html#refreshing-tokens

How to get online status of facebook user?

I wanna to understand how I can retrieve the online status of a Facebook user. For example, I'm logged in my application through JWT auth, and then in my settings page, I wanna to see my facebook online status.
Do I need to log in through OAuth, or just I can put on the field my facebook userID and then make a request to facebook API?
Also if it's possible to have socket connection with that online status to know in real time my status?
Maybe do you know cases with node.js and socket.io with it?
Thx
There is no way to get a user’s “online status”.
Do I need to log in through OAuth, or just I can put on the field my facebook userID and then make a request to facebook API?
Even if you did make an API request with a valid user token, that says little about the user’s online status.
The token stays valid for two hours (for a short-lived one), but the user isn’t necessarily online “on Facebook” for the whole time. Only if they logged out of your app explicitly, thereby invalidating the token, you could take the error message you would then get on the next attempt to make an API request using that expired token as an indicator. But then they would also have to login to your app again, before you could recognize them as “online” again.

Instagram API: How to obtain an access token

I need to make a PHP application that, given a hashtag, returns to me a XML with the posts related to that hashtag.
I logged into Instagram in the Developers section and filled the application setup form.
A "Client ID" and "Client Secret" were generated, but I did not see a generated Token Access anywhere.
One of the fields asks for "Valid redirect URIs:" but the application has not started being done yet, it will be all developed localhost and only then will it be published in a hosting provider.
In this case, how can I develop my functionality? What do I need to do to gain access granted by Instagram?
I found an online tool through which you type Client ID and Client Secret and it returns the Access Token.
However, the result was: {"error_type": "OAuthException", "code": 400, "error_message": "Redirect URI does not match registered redirect URI"}
Recently(last week) Instagram has stopped accepting submissions of new apps, That is the reason you are facing this problem to create new access token.
https://techcrunch.com/2018/04/02/instagram-api-limit/
Although for the already registered app, you can still get more access token by adding the additional new users.
https://developers.facebook.com/blog/post/2018/03/26/facebook-platform-changes/
Pause app review: We paused app review last week while we implement new changes to our platform.
https://www.instagram.com/developer/authentication
Receiving an access_token
In order to receive an access_token, you must do the following:
Direct the user to our authorization url.
If the user is not logged in, they will be asked to log in.
The user will be asked if they would like to grant your application access to her Instagram data.
The server will redirect the user in one of two ways that you
choose:
Server-side flow (recommended): Redirect the user to a URI of your choice. Take the provided code parameter and exchange it
for an access_token by POSTing the code to our access_token url.
Implicit flow: Instead of handling a code, we include the access_token as a fragment (#) in the URL. This method is less secure, but allows applications without any server component to receive an access_token.
Hope this will be helpful to you
I was getting the same error. Tried a few things, but doing this was the easiest:
http://instagram.pixelunion.net
As soon as I got my access token and user id, I made sure to revoke access literally the next minute. Hope it helps!

ERR_TOO_MANY_REDIRECTS error in response of Azure AD v2.0 authentication

I'm using Microsoft Graph to access a user’s Microsoft account data from within a Node.js web application, to call rest APIs. But once authentication done, instead of return to ReturnURL, I'm getting ERR_TOO_MANY_REDIRECTS in the browser.
Below is the Node application, I'm using:
https://github.com/microsoftgraph/msgraph-sdk-javascript
As I see, it seems like some how access token is conflicts and due to that passport is not able to authenticate my requests.
Can someone please help me out here, where I'm missing here. I didn't make any major changes in the app.
Please let me know if someone need more info.
Thanks.
I've seen a couple of examples of this occurring. It's hard to tell exactly what is happening from the limited information you've provided but here are some examples of what I've seen in the past:
redirect_uri pointing to an endpoint that automatically redirects the user back to https://login.microsoftonline.com/common/oauth2/v2.0/authorize?. This results in an infinite loop.
redirect_uri is returning a HTTP 3xx status indicating a redirect (301, 302, 303, 307, 308).
redirect_uri is pointing to a page that checks for an authenticated user. Since the user hasn't authenticated yet (you've got an authorization_code but not an access_token yet) it triggers the authentication workflow again.

How to troubleshoot login process to the OneDrive Business/Corporate?

For a two days I can't do login to get authorization code for the app.
During the login process, the authentication endpoint says nothing useful, for e.g. unauthorized user or client application or else. It's just redirect me to the https://login.microsoftonline.com/login.srf
Here is actual login url that I use: https://login.microsoftonline.com/common/oauth2/authorize?response_type=code&client_id=1dc49e01-ef07-4f66-9413-2ad70401b8c9&redirect_uri=http%3A%2F%2Flocalhost%3A9000%2Foauth.html
as described in documentation https://dev.onedrive.com/auth/aad_oauth.htm#step-1-log-in-and-get-an-authorization-code.
This is real client id and the application was registered as describe here https://dev.onedrive.com/app-registration.htm#register-your-app-for-onedrive-for-business
Could anyone help me with this challenge?

Resources