Git Product home page Git Product logo

client_credentials-dotnet's Introduction

MyWebApp

This project is a web application built using the ASP.NET Core Web App Boilerplate. It provides a simple UI with two buttons to load data from a backend API. One button invokes the API without any security headers, while the other button obtains a token using the client credentials grant and attaches the token to the API request.

Prerequisites

Getting Started

  1. Clone the repository:
git clone <repository-url>
  1. Navigate to the project directory:
cd MyWebApp
  1. Restore the project dependencies:
dotnet restore
  1. Build the project:
dotnet build
  1. Run the project:
dotnet run
  1. Update the configurations in the appsettings.json.

  2. Open a web browser to access the web application.

Usage

The web application UI contains two buttons:

  1. Load Data Unsecure: Clicking this button will invoke the backend API without any security headers. It will display the response from the API in the UI.

  2. Load Data Securely: Clicking this button will obtain a token using the client credentials grant and attach the token as a bearer token to the backend API request. It will display the response from the API in the UI.

Configuration

The web application uses the appsettings.json file for configuration. Ensure that you have the necessary configurations set up before running the application. Open the appsettings.json file and update the following values:

{
  ...,
  "ResourceAPI": {
    "BaseURL": "https://jsonplaceholder.typicode.com",
    "ChoreoAPIEndpoint": "https://85fd6187-f8a9-4cf2-9b62-d1ac4560b5fe-dev.e1-us-east-azure.choreoapis.dev/jfuk/hello/1.0.0"
  },
  "IdentityProvider": {
    "ClientId": "<your client id>",
    "ClientSecret": "<your client secret",
    "TokenEndpoint": "<your token endpoint>"
  }
}

Replace <Choreo API Endpoint> with the endpoint of your backend API, <client-id> with your client ID, <client-secret> with your client secret, and <token-endpoint> with the token endpoint URL.

Troubleshooting

  • If you encounter any issues related to dependencies or missing packages, try running dotnet restore to restore the project dependencies.

  • Ensure that the backend API is accessible and running. Verify the API endpoint and make sure it is functioning correctly.

  • Double-check the configuration values in the appsettings.json file. Ensure that the values for the backend API endpoint, client ID, client secret, and token endpoint are correct.

Contributing

Contributions to this project are welcome. If you find any issues or have suggestions for improvement, feel free to open a pull request or submit an issue.

client_credentials-dotnet's People

Contributors

sagara-gunathunga avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.