How to send new request to redirect URL with new access token

How to send new request to redirect URL with new access token

Date : January 11 2021, 03:26 PM
wish helps you The updated controller method is below. In the case of this site, I Should not have used a Bearer token. I had to send a User ID for the token to be applied to.
code :
  public async Task<IActionResult> AOFun(RequestValues requestValues)
            ServicePointManager.ServerCertificateValidationCallback += (o, c, ch, er) => true;
            string userID = requestValues.userId;
            string id = requestValues.id;
            string accessToken = requestValues.accessToken;
            string url =
            .Replace("{{idValue}}", id);
            using (var requestMessage = new HttpRequestMessage(HttpMethod.Get, url))
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.DefaultRequestHeaders.Add("userId", userID);
                client.DefaultRequestHeaders.Add("access_token", accessToken);
                var responseData = await client.SendAsync(requestMessage);
                var responseString = await responseData.Content.ReadAsStringAsync();
                ResponseModel rm = JsonConvert.DeserializeObject<ResponseModel>(responseString);
                ViewBag.ResponseString = rm.url;

        catch (Exception ex)
            ViewBag.ResponseString = "error: " + ex.Message;

        return View("Index");

Share : facebook icon twitter icon
Is it possible to send a request to the Facebook Graph API from client side without exposing our access token to the pub

Is it possible to send a request to the Facebook Graph API from client side without exposing our access token to the pub

By : mohamed
Date : March 29 2020, 07:55 AM
I wish this help you I found the answer after some Googling. In short, the answer is no.
And here's an excerpt from Facebook:
Facebook access token send to server with every request

Facebook access token send to server with every request

By : Prithu Banerjee
Date : March 29 2020, 07:55 AM
it helps some times Tokens being passed with every request and being verified on the server is the standard solution. Irrespective, of the HTTP method, it is again a standard practice to send the token as a HTTP Header.
While you're at it use the standard OAuth2 header for sending across tokens 'Bearer'. Like below.
code :
unable to exchange auth token with access token - redirect uri missmatch

unable to exchange auth token with access token - redirect uri missmatch

By : mmatt
Date : March 29 2020, 07:55 AM
Does that help Ok I go it,
if you see this
code :
def credentials_from_clientsecrets_and_code(filename, scope, code,
credentials = client.credentials_from_clientsecrets_and_code(
                  ['https://www.googleapis.com/auth/plus.me', 'profile', 'email'],
                  authCode, redirect_uri='https://developers.google.com/oauthplayground')
Should I explicitly send the Refresh Token to get a new Access Token - JWT

Should I explicitly send the Refresh Token to get a new Access Token - JWT

By : Denise C
Date : March 29 2020, 07:55 AM
Hope that helps Yes, the refresh token is used to obtain a new access token.
When you request the access token for the first time, you usually start by sending a token request to the token endpoint, in case of the so called Resource Owner Password Credentials Grant with user credentials in the request header, e.g.
code :
grant_type=refresh_token&refresh_token=<your refresh token>
Need to Store a Access token send from backend (json) into localstorage and login using that token. How?

Need to Store a Access token send from backend (json) into localstorage and login using that token. How?

By : Anon
Date : March 29 2020, 07:55 AM
I hope this helps . So once you receive the token back from your login request, you need to store your token. Looks like you are on the right track, thinking about localStorage. Also, I'd recommend going ahead and using the async/await syntax as its much easier to read / use. It requires you to leverage promises, but it much more readable. And rather than resolve / reject functions, you just wrap your code in try/catch blocks. So to store your token in localStorage after login, do something like this:
code :
async function handleLogin(un, pw) {
  try {
    let response = await fetch('https://example.api.com/login', {
        method: "POST", // POST
        mode: "cors",
        cache: "no-cache",
        headers: {
            'Content-Type': 'application/json; charset=utf-8',
            'Access-Control-Allow-Origin': '*',
            'Accept': 'application/json'    
        redirect: "follow",
        referrer: "no-referrer",
        body: JSON.stringify({
            isArray: false,
            data: {
                    email: document.getElementById("email").value,
                    password: document.getElementById("passwordNew").value
    response = response.json();
    window.localStorage.setItem('token', response.data.token)
  } catch(e) {
    console.log('error while logging in', e)
async function editProfile(updatedProfileInfo) {
  const token = localStorage.getItem('token');
    let response = await fetch('https://someurl.com/edit', {
      method: "POST",
      'x-access-token': token,
  //handle response
  } catch(e) {}
Related Posts Related Posts :
  • Passing enum type to Converter with integer value
  • Pool of objects with objects that are already on the scene in advance
  • StatusBar text fade-out when binding using Caliburn.Micro
  • Queryfilter on ApplicationUser in OnModelCreating in ApplicationDbContext creates StackOverflowException
  • How to get record form a different table based on a value from first table with linq expression?
  • Show data in Grid from returned model
  • Using Attributes to Override Data Model Conventions
  • Basic OOP console calculator, result Error
  • Compositon and Repository pattern
  • Multiple using statements with if condition
  • How do i increase a number by 1 in every line that contain the number 1
  • Add binding to elements that are created in codebehind
  • How to add a column in an existing AspNetUsers table
  • Order a list of elements with another list of doubles
  • How to setup a NuGet package to copy content files to output build directory?
  • In SignalR Core using ChannelWriter: Do I need to call TryComplete twice if there's an exception?
  • C# GetProcessesByName: issue with colon
  • c# wpf | create complex object with user-defined name to Serialize into JSON
  • How can I get a instance of a generic list with reflection?
  • WPF XAML - Design time and visibility of textbox
  • EF Core and MySql query is too slow
  • Getting Registered App Display Name from an App Id
  • How to get all variables from a string
  • Delete entity with all childs connected
  • Azure Build agent cant´t find class library referance
  • Initialize Nested Dictionaries in c#
  • .Net Core Binding
  • Loading a pop up page in ASP.net through a js file
  • How to pass alert or notification message from controller to View?
  • C# to pause, turn on ssas server, backup cube.... how to?
  • How to execute DataTable.Select() for a column of custom class type for a particular element in that C#
  • how to connect mysql8.0 with C#
  • Passing incorrect values into MultiValueConverter by MultiBinding
  • Can i use IEnumerator as Update func?
  • How to convert API Json response to C# Array?
  • Blazor Textfield Oninput User Typing Delay
  • Performing both layout and render transform results in wrong output
  • uwp beforetextchanged cursor moving in front of text
  • How to keep duplicates from a string[] exclude words from a List and print them out
  • .Net Core Strings.Asc/Mid/Chr/Len missing even after importing Microsoft.VisualBasic
  • How to return to previous search page without being asked to Confirm Form Re-submission and keeping the results on ASP.N
  • How set a identity scaffolding item/page how initial page in asp.net MVC core?
  • LINQ isn't calling Dispose on my IEnumerator when using Union and Select, expected behavior or bug?
  • What is "ByteArray.uncompress()" in AS3 equivalent to in C#?
  • Getting a specific letter from a string variable for my simple guessing game for clues
  • Send an email with Outlook without a subject --- dialog box issue
  • passing List<MyModel> from my controller in the "WebInterfaceProject" to the processor method in "D
  • How to convert Word document created from template by OpenXML into MemoryStream?
  • How can I make a single slider that changes the color of an object?
  • Remap JSON parameter in c#
  • What is the difference between "this ref" and "ref this" when talking about C# 7.2 ref extension met
  • Convert OpenSSL encryption into native C#
  • Accessing Properties in Razor Pages
  • How to get SOAP element value
  • Projection after Group
  • C# error cannot convert sytem.text.regularexpressions.match to string
  • Issues with Save/Load System in a Text Based Adventure game made with ScriptableObjects in Unity
  • VS2019 MSBuild.exe - ASP .Net MVC project fails to publish when using PublishProfile, but works when using OutDir parame
  • Does <pages validateRequest="false" /> in Web.config still matter?
  • Attempt to invoke virtual method on a null object reference Xamarin LockScreen
  • shadow
    Privacy Policy - Terms - Contact Us © festivalmusicasacra.org