How to make JWT bearer token request in Nop Api plugin

1 month ago
I want to authenticate by JWT bearer but I can't make successful request to get access token, can anyone please help me by sharing sample request of JWT token, made by PostMan or any other.

I am using this plugin

https://github.com/SevenSpikes/api-plugin-for-nopcommerce

Request I am making is like(please image in below links):
https://ibb.co/NF8VyKf
https://ibb.co/1RZNzZ3
1 month ago
I would need to look through their code to see how they generate the token, looks like they provide details here:
https://github.com/SevenSpikes/nopCommerce-Api-SampleApplication

in Postman you can send a JWT using the "Auth" tab with Bearer Token type:

1 month ago
MFadi99 wrote:
I want to authenticate by JWT bearer but I can't make successful request to get access token, can anyone please help me by sharing sample request of JWT token, made by PostMan or any other.
I am using this plugin
https://github.com/SevenSpikes/api-plugin-for-nopcommerce

Can you check this, might be it helps you.
1 month ago
https://jwt.io/
1 month ago
Sir the picture you have shared is about how to send jwt token.
I want to get jwt token

the sample app does not contains an example of jwt
1 month ago
MFadi99 wrote:
Sir the picture you have shared is about how to send jwt token.
I want to get jwt token


I understand that,  since you mentioned Postman I was trying to show how a JWT is used in that program.  

MFadi99 wrote:
the sample app does not contains an example of jwt


Are you able to install the sample app in a development instance of NopCommerce and step through the code?  In this file you can see how the token is created, but you will need to inspect their GetAuthorizationData method further:


                    var nopAuthorizationManager = new AuthorizationManager(authParameters.ClientId, authParameters.ClientSecret, authParameters.ServerUrl);

                    string responseJson = nopAuthorizationManager.GetAuthorizationData(authParameters);

                    AuthorizationModel authorizationModel = JsonConvert.DeserializeObject<AuthorizationModel>(responseJson);

                    model.AuthorizationModel = authorizationModel;
                    model.UserAccessModel = new UserAccessModel()
                    {
                        ClientId = clientId,
                        ClientSecret = clientSecret,
                        ServerUrl = serverUrl,
                        RedirectUrl = redirectUrl
                    };

                    // TODO: Here you can save your access and refresh tokens in the database. For illustration purposes we will save them in the Session and show them in the view.
                    Session["accessToken"] = authorizationModel.AccessToken;



Otherwise,  their documentation from the link above may help:
https://github.com/SevenSpikes/nopCommerce-Api-SampleApplication#how-to-use-the-client-application