Setting jwt audience in Azure Mobile Apps backend

僤鯓⒐⒋嵵緔 提交于 2020-01-25 13:00:07

问题


I am playing with an Azure Mobile Apps backend (nodeJS), as discussed here. I have been using the default web setup configuration to develop my mobile app, but now I want to customise the cloud backend functionality, so I have created a local backend with the Azure-Mobile-Apps SDK.

I logged in with my mobile app (using the authorization aspect of the Azure client SDK) and then captured the AuthToken, using a live managed backend setup.

When I then come to try and authorise a request, I get the following issue:

{ "name": "JsonWebTokenError", "message": "jwt audience invalid. expected: urn:microsoft:windows-azure:zumo" }

Following on from: Locally Testing Azure Mobile Auth - invalid jwt signature

How can I set the jwt audience?


回答1:


To set the audience and issuer, use the auth:{} object in your azureMobile.js. You can decode the JWT at jwt.io to see what the audience and issuer are, then do:

auth: {
    audience: '<your audience>',
    issuer: '<your issuer>'
};

Some good references:

  • My blog post on Custom Auth
  • The main configuration reference (which azureMobile.js exports)


来源:https://stackoverflow.com/questions/37944104/setting-jwt-audience-in-azure-mobile-apps-backend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!