Back
Use the following code
GithubSample = [ Authentication = [ OAuth = [ StartLogin = StartLogin, FinishLogin = FinishLogin ] ], Label = Extension.LoadString("DataSourceLabel") ]; StartLogin = (resourceUrl, state, display) => let AuthorizeUrl = "https://Github.com/login/oauth/authorize?" & Uri.BuildQueryString([ client_id = client_id, scope = "user, repo", state = state, redirect_uri = redirect_uri]) in [ LoginUri = AuthorizeUrl, CallbackUri = redirect_uri, WindowHeight = windowHeight, WindowWidth = windowWidth, Context = null ]; FinishLogin = (context, callbackUri, state) => let Parts = Uri.Parts(callbackUri)[Query] in TokenMethod(Parts[code]); TokenMethod = (code) => let Response = Web.Contents("https://Github.com/login/oauth/access_token", [ Content = Text.ToBinary(Uri.BuildQueryString([ client_id = client_id, client_secret = client_secret, code = code, redirect_uri = redirect_uri])), Headers=[#"Content-type" = "application/x-www-form-urlencoded",#"Accept" = "application/json"]]), Parts = Json.Document(Response) in Parts;
If u wish to learn about this BI tool, then you can sign up Power BI Certification
31k questions
32.8k answers
501 comments
693 users