如何使用"Azure存储容器URL";由PNS反馈服务返回? [英] How to use the "Azure Storage Container URL" returned by the PNS Feedback service?

查看:39
本文介绍了如何使用"Azure存储容器URL";由PNS反馈服务返回?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取有关推送通知的反馈,如下所述:

  • 测试一种.列出斑点

  •  获取https://pushpnsfb2f34ecd6733e74.blob.core.windows.net/00000000002000276266?< sas令牌e.t.sv = 2015-07-08& sr = c& sig = SQodHcRM6p04ag9rJZBqPDmr1NMd%2FbIWoPzMZrB9TpI%3D& se = 2020-09-02T05%3A28%3A07Z& sp = rl>& restype =容器& comp =列表 

    b.读取Blob内容

      GET GET https://pushpnsfb2f34ecd6733e74.blob.core.windows.net/00000000002000276266/<blob名称> ;?< sas令牌e.t.sv = 2015-07-08& sr = c& sig = SQodHcRM6p04ag9rJZBqPDmr1NMd%2FbIWoPzMZrB9TpI%3D& se = 2020-09-02T05%3A28%3A07Z& sp = rl> 

    有关Azure Blob rest api的更多详细信息,请参考https://docs.microsoft.com/en-us/previous-versions/azure/reference/mt705560(v=azure.100).

    Upon success, an Azure Storage Container URL is returned, complete with authentication token.

    I have the URL:

    https://pushpnsfb9bf61499e7c8fe.blob.core.windows.net/00000000002002698042?sv=2015-07-08&sr=c&sig=KbF1GtORNzAaCZH9UP7UFi9wMOYBmBgL%2BXLG3Qau9U0%3D&se=2020-08-29T19:10:17Z&sp=rl
    

    But requesting it returns an authentication error:

    <Error>
        <Code>AuthenticationFailed</Code>
        <Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature...</Message>
        <AuthenticationErrorDetail>Signature did not match. String to sign used was... </AuthenticationErrorDetail>
    </Error>
    

    I am trying to follow the docs at https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-service-sas-create-dotnet?tabs=dotnet#create-a-service-sas-for-a-blob-container. The URL has sr=c, which seems to mean I need a "SAS for a blob container".

    But where do I get the token? The returned URL has a sig querystring parameter - I tried using that to sign the request, but it didn't work.

    What am I doing wrong?

    解决方案

    When we call the Get Platform Notification Services (PNS) feedback rest api, we will get a container url with sas token. And the sas token has read and list permissions at container level. So we can use azure blob rest api to read the content, properties, metadata or block list of any blob in the container or list blobs in the container with the token. For more details, please refer to here

    For example

    1. Get container url

    2. Test a. list blobs

    GET https://pushpnsfb2f34ecd6733e74.blob.core.windows.net/00000000002000276266?
    <sas token e.t. sv=2015-07-08&sr=c&sig=SQodHcRM6p04ag9rJZBqPDmr1NMd%2FbIWoPzMZrB9TpI%3D&se=2020-09-02T05%3A28%3A07Z&sp=rl>
     &restype=container&comp=list
    

    b. read blob content

    GET GET https://pushpnsfb2f34ecd6733e74.blob.core.windows.net/00000000002000276266/<blob name>?
    <sas token e.t. sv=2015-07-08&sr=c&sig=SQodHcRM6p04ag9rJZBqPDmr1NMd%2FbIWoPzMZrB9TpI%3D&se=2020-09-02T05%3A28%3A07Z&sp=rl>
    

    For more details about Azure Blob rest api, please refer to here.

    这篇关于如何使用"Azure存储容器URL";由PNS反馈服务返回?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆