Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Gmanik446 July 25, 2017

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 votes
bentley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 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.

bentley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 31, 2017

Screen Shot 2017-07-31 at 10.59.10 AM.png

Gmanik446 August 21, 2017

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
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 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.

Gmanik446 August 22, 2017

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
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 22, 2017

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

Gmanik446 August 22, 2017

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

bentley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 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
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 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.

Gmanik446 August 29, 2017

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

bentley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 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
TAGS
AUG Leaders

Atlassian Community Events