<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic OAuth2 grant type authorization code in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/OAuth2-grant-type-authorization-code/m-p/3307914#M43294</link>
    <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;i'm trying to implement the OAuth2 authentication in a custom connector&lt;/P&gt;&lt;P&gt;the first time i run the connector it asks for username and password and then it asks for the authorization from the registered app, the second time i rerun the connector i'm not asked anymore the username and password but i'm asked only to approve the authorization for the registered app&lt;/P&gt;&lt;P&gt;how can i do to force the connector to ask me for username and password everytime i run the connector?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is the code i user&lt;/P&gt;&lt;P&gt;demo = [&lt;BR /&gt;TestConnection = (dataSourcePath) =&amp;gt; {"demo.Contents", dataSourcePath},&lt;BR /&gt;Authentication = [&lt;BR /&gt;OAuth = [&lt;BR /&gt;StartLogin = StartLogin,&lt;BR /&gt;FinishLogin = FinishLogin,&lt;BR /&gt;Label = Extension.LoadString("DataSourceLabel")&lt;BR /&gt;]&lt;BR /&gt;]&lt;BR /&gt;// Label = Extension.LoadString("DataSourceLabel")&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;StartLogin = (resourceUrl, state, display) =&amp;gt;&lt;BR /&gt;let&lt;BR /&gt;AuthorizeUrl = "https://[servername]/[tenant]/as/authorization.oauth2?" &amp;amp; Uri.BuildQueryString([&lt;BR /&gt;client_id = client_id,&lt;BR /&gt;response_type = "code",&lt;BR /&gt;// state = state,&lt;BR /&gt;redirect_uri = redirect_uri])&lt;/P&gt;&lt;P&gt;in&lt;BR /&gt;[&lt;BR /&gt;LoginUri = AuthorizeUrl,&lt;BR /&gt;CallbackUri = redirect_uri,&lt;BR /&gt;WindowHeight = windowHeight,&lt;BR /&gt;WindowWidth = windowWidth,&lt;BR /&gt;Context = null&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;FinishLogin = (context, callbackUri, state) =&amp;gt;&lt;BR /&gt;let&lt;BR /&gt;Parts = Uri.Parts(callbackUri)[Query]&lt;BR /&gt;in&lt;BR /&gt;TokenMethod(Parts[code]);&lt;/P&gt;&lt;P&gt;TokenMethod = (code) =&amp;gt;&lt;BR /&gt;let&lt;BR /&gt;&lt;BR /&gt;Response = Web.Contents(" https://[servername]/[tenant]/as/token.oauth2", [&lt;BR /&gt;Content = Text.ToBinary(Uri.BuildQueryString([&lt;BR /&gt;client_id = client_id,&lt;BR /&gt;client_secret = client_secret,&lt;BR /&gt;code = code,&lt;BR /&gt;grant_type = "authorization_code",&lt;BR /&gt;redirect_uri = redirect_uri])),&lt;BR /&gt;IsRetry = true,&lt;BR /&gt;Headers=[#"Content-type" = "application/x-www-form-urlencoded",#"Accept" = "application/json"]]),&lt;BR /&gt;Parts = Json.Document(Response)&lt;BR /&gt;in&lt;BR /&gt;Parts;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Jun 2023 09:16:29 GMT</pubDate>
    <dc:creator>Giampaolo</dc:creator>
    <dc:date>2023-06-29T09:16:29Z</dc:date>
    <item>
      <title>OAuth2 grant type authorization code</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/OAuth2-grant-type-authorization-code/m-p/3307914#M43294</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;i'm trying to implement the OAuth2 authentication in a custom connector&lt;/P&gt;&lt;P&gt;the first time i run the connector it asks for username and password and then it asks for the authorization from the registered app, the second time i rerun the connector i'm not asked anymore the username and password but i'm asked only to approve the authorization for the registered app&lt;/P&gt;&lt;P&gt;how can i do to force the connector to ask me for username and password everytime i run the connector?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is the code i user&lt;/P&gt;&lt;P&gt;demo = [&lt;BR /&gt;TestConnection = (dataSourcePath) =&amp;gt; {"demo.Contents", dataSourcePath},&lt;BR /&gt;Authentication = [&lt;BR /&gt;OAuth = [&lt;BR /&gt;StartLogin = StartLogin,&lt;BR /&gt;FinishLogin = FinishLogin,&lt;BR /&gt;Label = Extension.LoadString("DataSourceLabel")&lt;BR /&gt;]&lt;BR /&gt;]&lt;BR /&gt;// Label = Extension.LoadString("DataSourceLabel")&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;StartLogin = (resourceUrl, state, display) =&amp;gt;&lt;BR /&gt;let&lt;BR /&gt;AuthorizeUrl = "https://[servername]/[tenant]/as/authorization.oauth2?" &amp;amp; Uri.BuildQueryString([&lt;BR /&gt;client_id = client_id,&lt;BR /&gt;response_type = "code",&lt;BR /&gt;// state = state,&lt;BR /&gt;redirect_uri = redirect_uri])&lt;/P&gt;&lt;P&gt;in&lt;BR /&gt;[&lt;BR /&gt;LoginUri = AuthorizeUrl,&lt;BR /&gt;CallbackUri = redirect_uri,&lt;BR /&gt;WindowHeight = windowHeight,&lt;BR /&gt;WindowWidth = windowWidth,&lt;BR /&gt;Context = null&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;FinishLogin = (context, callbackUri, state) =&amp;gt;&lt;BR /&gt;let&lt;BR /&gt;Parts = Uri.Parts(callbackUri)[Query]&lt;BR /&gt;in&lt;BR /&gt;TokenMethod(Parts[code]);&lt;/P&gt;&lt;P&gt;TokenMethod = (code) =&amp;gt;&lt;BR /&gt;let&lt;BR /&gt;&lt;BR /&gt;Response = Web.Contents(" https://[servername]/[tenant]/as/token.oauth2", [&lt;BR /&gt;Content = Text.ToBinary(Uri.BuildQueryString([&lt;BR /&gt;client_id = client_id,&lt;BR /&gt;client_secret = client_secret,&lt;BR /&gt;code = code,&lt;BR /&gt;grant_type = "authorization_code",&lt;BR /&gt;redirect_uri = redirect_uri])),&lt;BR /&gt;IsRetry = true,&lt;BR /&gt;Headers=[#"Content-type" = "application/x-www-form-urlencoded",#"Accept" = "application/json"]]),&lt;BR /&gt;Parts = Json.Document(Response)&lt;BR /&gt;in&lt;BR /&gt;Parts;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2023 09:16:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/OAuth2-grant-type-authorization-code/m-p/3307914#M43294</guid>
      <dc:creator>Giampaolo</dc:creator>
      <dc:date>2023-06-29T09:16:29Z</dc:date>
    </item>
  </channel>
</rss>

