what is the best way to implement access token in play framework

时间:2017-06-12 16:48:31

标签: playframework playframework-2.2 playframework-2.1 playframework-2.3 playframework-2.5

I am working on a project with play framework 2.5 which provides API service for developers.

I now want to implement access token with play framework in order to control the access of the server APIs.

I have implemented app key and app secret already. Can anyone please advices how to generate the access tokens?

1 个答案:

答案 0 :(得分:1)

使用JavaWebTokens(jwt),它将始终为您提供唯一的密钥,

var arr = [
{'status':'ok'},
{'status':'ok'},
{'status':'error'}
]

var arr2 = [
{'status':error, 'msg': 'etc', 'more property':true}
]

arr = arr.forEach(obj => { if(obj.status === 'error'){obj = arr2[i]} return obj })