How to get the control back to my app, If user clicks on DENY button in Trello Authorization screen Edited

In our application we are using Trello authentication and authorization flow to get the consent from user. Below is the code sample that we are using for user Trello Authorization.

 

Trello.authorize({
             type: "redirect",
             name: "Trello for MyApp",
             scope: {
                          read: true,
                          write: true
                        },
             expiration: "never",
             success: authenticationSuccess,
             error: authenticationFailure
});

function authenticationSuccess() {
          console.log("Authentication success");
}

function authenticationFailure() {
          console.log("Authentication failed");
}

 

Once user chosen an account and login, trello is giving control back to my application by calling success call back method "authenticationSuccess". But If user clicks on "DENY" button in authorization screen, then trello is not giving control back to my application. The failure call back method "authenticationFailure" is not executing. Could you please suggest me, how can I get the control back to my App when user clicks on "DENY" button?

1 answer

0 vote
Bentley Cook Atlassian Team Jul 31, 2017

It looks like this only happens when using type: "redirect". Here is an example of using type: "popup"https://glitch.com/edit/#!/using-trello-js?path=public/example.js

We'll look into seeing if this is something we can fix. I'll update here when I find out more.

Thank you for the reply. As per Trello documentation, if we set interactive:false, then it doesn't redirect or popup and only uses the stored access token. But in my case, I need to redirect the user.

Bentley Cook Atlassian Team Aug 21, 2017

On the initial page-visit you should make the call without interactive: false - this will cause them to be redirected. Once they have selected Accept or Deny, they will be redirected back to your page at which point you should make the call again with interactive: false. If they did select Deny then at this point in time your authenticationFailure will be called.

It's not redirecting to our page when user selected Deny. It's simple showing page as shown in below image.

Token reject.PNG

This is the issue we are facing.

Bentley Cook Atlassian Team Aug 22, 2017

@Gmanik446 Are you using type: "popup" or type: "redirect" when you see that?

We are using type:redirect. You can find the sample code in my question description.

Bentley Cook Atlassian Team Aug 23, 2017

@Gmanik446 I've put together an example project of how to use type: redirect here: https://glitch.com/edit/#!/discreet-minibus?path=public/example.js:6:0.

You will want to call Trello.authorize with interactive: false on page load to see if the user has authorized or not. If they have no authorized, you will want to call Trello.authorize again but this time with interactive: true so that they are redirected.

Bentley Cook Atlassian Team Aug 28, 2017

@Gmanik44 When a user is not logged in and selects Deny when prompted to authorize with an app, we intentionally only show the error message, "Token request rejected." We intentionally do not redirect because then that route would be an open redirect for non-logged-in Trello users and could be abused to phish accounts.

@Bentley CookThank you for reply. Is there any way or work around to redirect user when users selects Deny?

Bentley Cook Atlassian Team Aug 30, 2017

@Gmanik446 For non-logged-in users, no. For logged-in users, control is returned to you.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Fadoua M. Boualem
Published yesterday in Trello

Using Trello to manage events

As a Jira power user, I was at first doubtful that Trello could benefit my workflow. Jira already uses boards (ones you can customize!), so why would I even need to use Trello?! In this post you will...

365 views 5 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you