Is there a way for the instagram auth(login) to always ask for authentication? This is skipped when the user is logged in and has already authorized the app.
It would be something like twitter's use_authorize=true
or google's approval_prompt=force
.
I believe that the most simple way is to use next url:
https://instagram.com/accounts/logoutin/?force_classic_login=&next=URLENCODED_INSTAGRAM_OAUTH_URI_PATH_WITH_YOUR_DATA
For example:
window.location.assign('https://instagram.com/accounts/logoutin/?force_classic_login=&next=' + encodeURIComponent('/oauth/authorize/?response_type=code&scope=public_content+follower_list+comments&client_id='+ YOUR_IG_CLIENT_ID + '&redirect_uri='+encodeURIComponent(YOUR_REDIRECT_URI)));
Please take a note that your redirect uri should be encoded twice
I managed to get it working:
I try loading an image with the url of the instagram logout page before opening the authorize popup.
Something like this (coffeescript):
windowOpen = ->
window.open("/instagram/authorize?...")
if forceLogin
tryLogout().always ->
windowOpen()
And the tryLogout function (setTimeout 10seconds as a fallback)
tryLogout: ->
deferred = $.Deferred()
logOutImg = new Image()
logOutImg.onerror = ->
deferred.resolve()
logOutImg.onload = ->
deferred.resolve()
logOutImg.src = 'https://instagram.com/accounts/logout/'
setTimeout(->
deferred.reject()
, 10000)
return deferred.promise()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With