<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How do I add authorization on read and write characteristics?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/62913/how-do-i-add-authorization-on-read-and-write-characteristics</link><description>I have a created a custom service and a custom characteristics. The characteristics has both read and write properties. Now I want to authorize the read and write opearations . I have already aded these lines in my code. 
 ble_attr_md.rd_auth = 1;
ble_attr_md</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 23 Jun 2020 12:49:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/62913/how-do-i-add-authorization-on-read-and-write-characteristics" /><item><title>RE: How do I add authorization on read and write characteristics?</title><link>https://devzone.nordicsemi.com/thread/256452?ContentTypeID=1</link><pubDate>Tue, 23 Jun 2020 12:49:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e51058b6-cada-4dba-a8b0-f48fc8796f91</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user=""]But I am unable to handle the events for BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST. Please let me know how to handle these events and how and where to set the passwords. I am usig SDK_v16.0 and nRF52832 DK.&lt;br /&gt;Please provide any code example if u have any.[/quote]
&lt;p&gt;Settings those values to 1 is the only extra thing to initialize the attribute with rd and write authorize flags.&lt;/p&gt;
&lt;p&gt;After that you need to handle the&amp;nbsp;&lt;span&gt;BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST when there is an access to the attribute as shown &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v7.0.1%2Fgroup___b_l_e___g_a_t_t_s___w_r_i_t_e___r_e_q___a_u_t_h___m_s_c.html"&gt;here &lt;/a&gt;and &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s132.api.v7.0.1%2Fgroup___b_l_e___g_a_t_t_s___r_e_a_d___r_e_q___a_u_t_h___m_s_c.html"&gt;here&lt;/a&gt;. Unfortunately we do not have any direct example to show this in our sDK&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>