I have an angularjs web application that uses Azure Active Directory for authentication.
The Web Api that the application uses, authenicates without any errors.
For client-side authentication I am using adal.js and adal-angular.js.
When i try to visit any page in my app, authentication fails and prints the following messages in the console
The returned id_token is not parseable.
Route change event for:/
Start login at:https://localhost:44308/#
Navigate url:https://login.windows.net/myapp.onmicrosoft.com/oauth2/authorize
Navigate to:https://login.windows.net/myapp.onmicrosoft.com/oauth2/authorize
TypeError: Cannot read property 'data' of undefined
I have followed this tutorial.
Does anyone know what is going on or how can I debug this?
The error was in the adal.js library when the token which didn't decode correctly utf-8 characters.
An updated version of the library with the bug fix will be available soon.
It's tough to answer without seeing a code sample. If you're using promises, you need to handle the case if the promise is rejected. You probably have something like this:
myAuthService.authenticate(...).then(function(data){
//this handles the successful call.
});
What you need to see the error is something like this:
myAuthService.authenticate(...).then(function(data){
//this handles the successful call.
}, function(e){
//this handles the error case
alert('errror. inspect this.arguments');
});
You should post the code that is throwing the error.
Related
Im trying to get basic data from instagram profiles, I am using a local webpack dev server to run my react app, I am also using Firebase functions, the function on firebase sends oauth/authorize request to instagarm's api, im getting a code response back and return it to my react popup, i then send the code to instagrams api for oatuh/access_token but im getting the following error:
Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request
Im running localhost:3000 as https with an ssl, i've set the redirecturl in the instagram developer tools to https://localhost:3000/instagram-popup/
the popup is the page I'm, loading to get the access token, it does get the code from the firebase function correctly, but fails the last call... I have lost SO many hours on this issue, if anyone has been in this situation and solved it, or didnt even encounter it but knows what i can do to fix it, i would really appreciate any guidance here
I hope you are all doing good,
I have a question that I've been stuck on for the past couple of days.
I am building a website with React that uses AWS-Amplify for user authentications (For users on the Cognito AWS database).
I am working on the Log-in and Sign-up page, and it's working fine when using Chrome, but whenever I am using Firefox there is an issue (Specifically the Log-in).
Problem: There is a part in the JS code that uses the Auth.signin() function from the aws-amplify extension. This function takes in the username and password and returns if the user is authenticated or not. However, when using Firefox, this function gets timed-out, as if the browser can't get the response from the server. Here is a screenshot of the console:
Seems like the response is 403 but I am guessing it's because of the time-out.
(The try/catch doesn't catch anything because it looks as if the page freezes)
I hope I made it clear, and thank you for your time reading everything!
Do your request headers/body contain the correct username and password for the user in Firefox, and is it sending the request to the same endpoint as in Chrome? The 403 code makes me think that the endpoint is malformed on the Firefox request. Finally, is it sending with SRP_AUTH or USER_PASSWORD_AUTH?
Also, since you're using React with Cognito+Amplify for auth*, you might want to consider using the withAuthenticator higher-order-component provided by aws-amplify-react and styling it to your needs. Then you won't need to maintain your own login logic, won't need to worry about fixing it yourself if a browser change breaks your code, etc.
When i try to login to my app through facebook, it does not show me whether it was successful or unsuccessful.
Already tried going onto developer.facebook to enter my Hash and App ID Properly.
reinstalled cordova-plugin-facebook4
removed and added back android in ionic platforms
this.fb.login(['email', 'public_profile']).then((response:
FacebookLoginResponse) => {
this.provider = 'facebook'
this.providerId = response.authResponse.userID
this.token = response.authResponse.accessToken
this.showAlert(this.token,this.providerId)
})
expected Alert to be shown with token displayed whether undefined or not, but the actual output does not show
Are you checking this with Chrome Console using a real device/emulator? Cordova plugins won't work when testing using ionic serveon Laptops/PCs.
I would suggest checking if there's an error coming back (add a catch) from the call. Add logs throughout your authentication code flow and check for outputs at every step.
Follow this tutorial: Ionic Facebook Auth Tutorial
If you follow every step described you should be good to go.
I had an issue with this plugin a while back but I was getting the response back, problem I was having was related to redirection. I suggest you check my question's answer if it helps:
Ionic Facebook Authentication Redirection Problem
My AngularJS project is working with an API. This API provides authentication tokens (Oauth): an access_token and a refresh_token.
Everytime an AngularJS request to the API returns a 401 error, it means that the access_token has expired and it needs to be refreshed by sending the refresh_token to a specific URL. To do that, I followed this tutorial.
But this is not working and I don't know why. I would like to debug the function placed into .config(...) but I don't know how to do that. console.log() and $rootScope = ... doesn't work here.
Thanks for your help !
Use your browser's built-in debugger.
Chrome: https://developer.chrome.com/devtools/docs/javascript-debugging
Firefox: https://developer.mozilla.org/en-US/docs/Tools/Debugger
Firebug: http://getfirebug.com/javascript
IE: https://msdn.microsoft.com/en-us/library/gg699336%28v=vs.85%29.aspx
I'm creating an app that prints out a pdf from the server after it has been generated.
When using google cloud print I keep getting:
User credentials required
Error 403
Note: making this print request in the simulating page works fine, but that's because I'm already logged into my google account.
After doing some research I found out I need to use OAuth to get an access token to send with the request to make a print job.
And every single page I can find tells me to redirect me to: https://www.googleapis.com/auth/cloudprint, which gives me a 404 error, neither can I find it in the google playground, and using any older versions of authentication ends up in the request to sign in being flagged as an attack from a hacker.
Is there any way around this?
I was stuck on this for a while. The docs don't tell you which scope to use or how to use it. I haven't implemented a Google API using OAuth2 yet, so I didn't have an understanding of how the scoping works.
It turns out the scope is just the base API route for CloudPrint.
To make sure your refresh_token or access_token is scoped properly to use the CloudPrint API you need to use have the following string in your scope object:
https://www.googleapis.com/auth/cloudprint