Reputation: 6402
I'm building an application that asks the user to authorize the application to use him Trello account.
First, I use my developer key (provided by Trello) and do a API call, like that:
Trello.authorize({
type: 'popup',
name: 'My App',
persist: 'true', // the token will be saved on localstorage
scope: {
read: 'true',
write: 'true'
},
expiration: 'never',
success: authenticationSuccess,
error: authenticationFailure
});
This shows a pop up asking to user to allow (authorize).
My question is, how can I get the token in this request? This method doesn't deliver any response.
The only way I found to get the token is: send the user to...
https://trello.com/1/connect?key=my_developer_key&name=My+App&response_type=token&scope=read,write
However, the user lands on a blank page that shows:
"You have granted access to your Trello information." "To complete the process, please give this token:" "21265656542121245...sometoken"
I don't want the user needs to give me any token.
Can any one help me with this issue? Thanks
Upvotes: 1
Views: 1443
Reputation: 296
In Angular, since persist = true
(by default) in authOpts, I was able to access the token from the local storage using localStorage.getItem('trello_token')
after successful authentication.
Upvotes: 1
Reputation: 625
In authenticationSuccess
you will be able to check the localStorage
:
localStorage.trello_token
Hope it help.
Upvotes: 2