Utilizing AngularJS, I am implementing a button for users to authorize Instagram access.
To test this functionality, I can pass the following URL and receive the accessToken in the redirectURL:
The challenge lies in how to trigger this flow on a button click event in AngularJS. Currently, my setup is as follows:
HTML Code:
Authorize to Instagram
JavaScript Code:
app.controller('AdminController', ['$scope', function($scope){
...
this.authorizeIg = function(){
console.log('Initiating authorization flow for Instagram');
window.location.href = "https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=token";
};
The current implementation only redirects me to the specified redirect URL after authentication. I am uncertain of how to make the API call within the function and retrieve a response with the accessToken.