I try to be specific. I have an app created in facebook When logged manually (go in https://developers.facebook.com/tools/explorer) I get access token type:
"CAAVLIUVx7w0BAPRY9h6IfBKmolxumLLGbvwpLzLh7YG5gWrSOqczbqJM31AnZAW86RPrudLpJ123TKYqZBZCGxR8R1JvBNUQZBCSG2EMXuliaqrgiJKZd213CZA0gQ0c6NdmsJA1mUSrSjxEVLcsZA4OXK8X1hlV9ioWtp20mp81cQJ6YKivh2Jrwt1ZBmffo1YQKUWW6o2WViEuEpQ5suQZDZD"
Then I introduce the access token code in python and works perfectly, but when I close the session on facebook this access token stops working and gives me the error:
OAuthError: [190] Error validating access token: This May be Because the user logged out or May be due to a system error.
My question is: Is there any way to get the access token automatically without human intervention.
(sorry, I speak Spanish and I am using a translator)
Thank you for responding friends.
Related
Im not sure why but when trying to use the following code I get ('Access blocked: This app’s request is invalid' and 'redirect_uri_mismatch') when the browser window opens:
gc = gspread.oauth(
credentials_filename='auth/oauth_creds.json'
)
I have already enabled the needed apis and download the creds for the OAuth client IDs, not sure why I am hitting this error, this is my first time using gspread, in the past I used the normal libs that gspread seems to wrap, but it has been a while.
Redirect uri miss match is one of the most common Oauth2 errors. The redirect uri you have entered in google cloud console for your app must exactly match the one that your application is sending from.
There should be an error details link you can click on it will tell you the exactly redirect uri you should enter into google developer console.
Google OAuth2: How the fix redirect_uri_mismatch error. Part 2 server sided web applications.
All i wanted to run a python script to read email from office365 using graph-api.
Everywhere i can see that examples with browser interaction for getting the accessToken.
i have tried with these steps in https://dzone.com/articles/getting-access-token-for-microsoft-graph-using-oau . Retrieved the Access token successfully. But when try to access https://graph.microsoft.com/v1.0/me/messages with access token ended up with "code":"BadRequest","message":"/me request is only valid with delegated authentication flow.".
Can someone help me with proper guidance or available examples.
I have an Azure Webapp running a Docker container (with Python & streamlit). I have secured the access to this webapp by adding a Microsoft SSO allowing only users from my organization to access the application.
On top of this, I would like to get the username or email of the user after the authentication so I can give the users differents levels of access inside the webapp. I have searched through the vast Microsoft documentation but I was not able to find my way through it. Is someone able to put me on the right path to tackle this problem?
For now, I have namely tried to follow the following documentation:
https://learn.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/app-aad-token hoping that I could access the user email with the authentication token from the Azure directory.
But I am stuck with an error that I was not able to solve:
Error 401: "An error of type 'invalid_resource' occurred during the login process: 'YYYYYYYY: The resource principal named xxxxxxxxxxxx was not found in the tenant named tenant_name. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant."
I am now doubting that what I am trying to achieve is even possible. Any help would be appreciated.
Best, clank
• It is aptly written in the documentation link that you have stated that your application should have admin access and its consent for accessing the APIs in Azure databricks. Thus, as per the error statement that you are encountering, it might be that your application might not have the correct permissions to access the respective resources based on its assigned service principal.
• Also, please take note of the token issued by the Azure AD when queried a test application created wherein when decoded on ‘jwt.io’ clearly states the information regarding the user including its email address. This access token issued using authorization code flow as stated in the documentation link connects to the application created successfully but the application fails to decode the token and use the information of the user in it for allowing the user to access its resources. The application fails to decode the token because required MSAL library redirection and resource files were missing at the location of App redirect URI. Similarly, you are trying to access email address from the issued access token and use it for giving varying levels of access in the application which is not possible as the token even if intercepted in between would not be able to access user information from it since it is encrypted using the SSL key certificate and the base 64 encoding.
• To provide access to your users in varying degrees, please refer the below documentation link which describes how you can leverage dynamic groups and Azure AD conditional access policies for your requirement.
https://learn.microsoft.com/en-us/azure/active-directory/manage-apps/what-is-access-management
I've written a python script to use the Instagram API to find all the media associated with a given user. This user is one of the users that I follow on Instagram.
When running this line of code...
api.user_recent_media(user_id=user, count=sys.maxint)
...I get the following error:
(400) APINotAllowedError-you cannot view this resource
Why am I getting this error if I'm querying a user that I follow? What am I doing wrong? Thanks!
You need to use an access_token generated for your account.
Basically the Instagram permissions for the Users endpoint works like this:
If the target user is public, you can query that user's info and media with a client_id without the need for any authentication.
If the target user is private, using the client_id will not work and you need to do authentication and use the access_token from an authenticated user that follows that target user.
I ended up using the wrong access token (from a different account).
Thanks!
I have a website that essentially requires that the user be logged in to see anything. If they are not logged in then they are redirected to the front page and a login form.
I currently use Django's standard authentication and test for authentication server-side before returning the page.
I now want to add Facebook login and authentication. Does this mean that I need to make a server-side call to Facebook and verify authentication every single time that a user navigates to any page? It seems that this will add quite a number of calls and potential page delays.
Or, is this not really a concern (Facebook call is fast) or is there some other clever way that I am missing? Somehow move the call client-side where I believe that Facebook uses caching?
I've looked at some of the Django/Facebook packages, but none seem to explain the overall strategy, which is what I'm looking to understand. The tutorials that I have looked at describe how to login, but don't worry about what happens once a user logs out of Facebook.
Basically, the user logs in once using facebook (this will make a request to facebook).
once is logged in, it will behave just as a normal django user (most apps create a Django User for each facebook user)
Only when the access token is expired (the "password" for using the facebook data) than you will need to make a connection to facebook again.
Ill recommend you to use Python Social Auth which basically does everything for you.