I want to authenticate against the oath2/token url using code:
Hi Fedorov,
Thanks for sharing your solution.
After having read up about oauth2 I now have come to the conclusion that it is not possible to obtain a token from login.microsoft due to browser security features in combination with the fact that I'm not in control of the login.microsoft server. Therefore I cannot tell the server to allow calls from this client with a specific address. ("allow origin").
The thing was that a 3rd party who have no experience with oath2 wanted to authenticate using javascript and I wanted to provide them an example of how to do it to help them.
The solution will instead be that they will create their own server which their client will call and then they will make a request from their server to obtain the token.
Hi Fedorov,
I'm afraid that blank html-page with javascript inside can't work. Could you tell us why you need to get token in the html? What do you want to achieve?
Thanks for your reply.
I think your link is relevant but I don't have the skills to implement this apparently because it's examples are using an "import" command that throws some error:
"Cannot use import statement outside a module"
When googling the error it suggest using a "module" statement but I just can't get it to work. I'm just using a blank html-page with javascript inside. No NPM packages or anything...
Hi Fedorov,
Are you creating a single page application to authenticate? If so, please refer to this doc:
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156